Compose.jl icon indicating copy to clipboard operation
Compose.jl copied to clipboard

fontweight and fontstyle property

Open dcjones opened this issue 9 years ago • 5 comments

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

dcjones avatar Dec 23 '14 03:12 dcjones

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..?

tbenst avatar Mar 24 '21 05:03 tbenst

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.

Mattriks avatar Mar 24 '21 09:03 Mattriks

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

tbenst avatar Mar 26 '21 03:03 tbenst

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.

Mattriks avatar Mar 26 '21 04:03 Mattriks

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"))

tbenst avatar Apr 29 '21 17:04 tbenst