Code Monkey home page Code Monkey logo

Comments (7)

deeplook avatar deeplook commented on August 17, 2024

While this can be actually true, testing it with a font like Verdana makes little sense without embedding that font in the output PDF, which is not supported yet, IIRC, as mentioned in #89.

from svglib.

2minchul avatar 2minchul commented on August 17, 2024

same problem. font_weight='bold' not working for me

from svglib.

morphonedev avatar morphonedev commented on August 17, 2024

Ragarding this issue I tested a little. (Platform Windows 10)
Created a test svg in Inkscape and got something like this : FontSample.svg.txt
(Had to rename it to txt to get it uploaded).
While the intended result is:
IntendedResult
The result looks likes this:
FontSample_Org
Even after registering the necessary fonts:

register_font("Times New Roman", 'times.ttf')
register_font("Courier New", 'cour.ttf')

The result is:
FontSample_Org-Reg

So my proposal would be to introduce a font map were a font family, weight and style can be mapped to specific font.
Then something like:

register_font("Times New Roman", 'times.ttf')
register_font("Times New Roman", 'timesbd.ttf', weight='bold')
register_font("Times New Roman", 'timesi.ttf', style='italic')
register_font("Times New Roman", 'timesbi.ttf', weight='bold', style='italic')

would create the desired output.

If you are interested in such a solution, a can provide a pull request, with the necessary changes.

from svglib.

deeplook avatar deeplook commented on August 17, 2024

All contributions are welcome! Just make sure to check if this is something to add to svglib or rather to reportlab itself, maybe.

from svglib.

deeplook avatar deeplook commented on August 17, 2024

Can we close this now that we have #268?

from svglib.

claudep avatar claudep commented on August 17, 2024

I just test the above font svg file, and all lines render fine except the Times-Italic weight 800 one. But this could be handled in a new ticket, discussing how numeric font weight should be handled (e.g. > 700 could be converted to Bold).

from svglib.

deeplook avatar deeplook commented on August 17, 2024

Fine, then let's close this, and feel free to open a new one.

from svglib.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.