freetype-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Some questions about the OT-SVG implementation


From: Werner LEMBERG
Subject: Re: Some questions about the OT-SVG implementation
Date: Wed, 03 Nov 2021 08:46:56 +0000 (UTC)

Hello Moazin,


> 1. `FT_LOAD_NO_SCALE`: For CFF/TTF outlines, this flag loads the
>    outlines, but in font units, if you directly render it by
>    `FT_Render_Glyph`, the render functions just assume that the
>    points are in 26.6 point format, which isn't the case and thus
>    you get a very small rendering (of size ~15 I think).

Correct.  `FT_LOAD_NO_SCALE` is not intended to be directly used for
rendering, since rendering always needs a transformation to the output
device space.

>    I'm not sure what to do with this flag when it comes to OT-SVG
>    glyphs.  For OT-SVG glyphs, I don't really have any outline data,
>    I just store a transformation matrix with scale information that
>    takes care of the sizing.  If we leave the matrix to identity,
>    it'll render to whatever the viewBox is set to in the SVG
>    document, which is sometimes 1000x1000 or 128x128, or it could be
>    anything really.  Another option is to set a transform such that
>    if you directly render the glyph it'd be at the same scale at an
>    equivalent TTF/CFF glyph which was loaded via FT_LOAD_NO_SCALE.
>    I'm completely clueless about which one to go about.  Any
>    thoughts on this?

Harmonizing with other formats is a good idea IMHO.  What about
scaling the SVG data to the `units_per_EM` value for this particular
case?

> 2. `FT_LOAD_MONOCHROME` and other LCD modes: So this flag
>    `FT_LOAD_MONOCHROME` and other `FT_RENDER_MODE_XXX` flags are
>    there and I don't think it makes sense to keep these for OT-SVG
>    glyphs.  The very reason why there is OT-SVG is that people want
>    colored fonts.  I'm not sure if the LCD modes make any sense?
>    Maybe I can return errors from the rendering module if these
>    modes are requested in `FT_Render_Glyph`?

My point of view is that if you have a font, and you ask for a given
glyph, regardless of the rendering mode, FreeType should produce
something.  So if the font in question only has SVG data for a given
glyph, it should be rendered even in monochrome or LCD.

It shouldn't be too difficult to implement that, I think: the SVG
interface returns an outline, which gets then handled by one of
FreeType's rasterizers, right?


    Werner



reply via email to

[Prev in Thread] Current Thread [Next in Thread]