GiovineItalia / Compose.jl

Declarative vector graphics
http://giovineitalia.github.io/Compose.jl/latest/
Other
248 stars 81 forks source link

fontweight and fontstyle property #103

Open dcjones opened 9 years ago

dcjones commented 9 years ago

Mirroring the SVG properties, allowing for bold, italic, etc.

tbenst commented 3 years ago

Old issue, but wondering if there is now a way to eg specify that all text should be normal and not bold (edit: in Gadfly)? Guessing this would depend on this issue being resolved..?

Mattriks commented 3 years ago

The default text fonts for Compose and Gadfly are here and here (they're not bold). In Gadfly, the current way to blanket change the fonts would be to create a custom theme. For fonts per text, see this discourse post.

tbenst commented 3 years ago

Thanks! For some reason, when I import SVG from Gadfly into Illustrator, the text is "doubled" giving the appearance of bold. Easy enough to delete one copy. And good to know about text, thx for the pointer

Mattriks commented 3 years ago

In svg, the font-family attribute can contain several fonts. You can see this also for Gadfly, by opening the svg file in a text editor. I don't use illustrator, so I'm wondering if illustrator attempts to render all the given fonts. You could test that by manually deleting (in a text editor) all the listed fonts for font-family except one.

tbenst commented 3 years ago

For what it's worth I figured out my issue (turns out not related to original post):

This will result in doubled text that appears bold:

font_size = 18pt
fig = compose(context(), Compose.text(0,font_size,"example text"),
            Compose.stroke("black"), fontsize(font_size))
fig |> SVG(joinpath(@__DIR__, "text_example.svg"))

This will not:

font_size = 18pt
fig = compose(context(), Compose.text(0,font_size,"example text"),
            Compose.fill("black"), fontsize(font_size))
fig |> SVG(joinpath(@__DIR__, "text_example.svg"))