freetype
[Top][All Lists]
Advanced

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

[ft] How to get nominal height for an FT_Face?


From: Sascha Brawer
Subject: [ft] How to get nominal height for an FT_Face?
Date: Mon, 22 Oct 2018 08:24:40 +0200

How to reliably retrieve the nominal height (in typographic points, not in
pixels) for an FT_Face?

Background: I’m maintaining Unicode’s test suite for text rendering engines
[1]. Like other apps, my test runner uses FreeType, HarfBuzz and Raqm to
render text. First, the application loads a font file into FreeType; then
it calls FT_Set_Char_Size()  on the FT_Face; then it passes the FT_Face to
Raqm. Internally, Raqm uses HarfBuzz for shaping.

Now, for shaping fonts with an AAT `trak` table, HarfBuzz needs to know the
nominal size in typographic points. The app already passes this to
FT_Set_Char_Size(), but currently nobody calls hb_font_set_ptem() to inform
HarfBuzz about the nominal point size. Thus, the information gets lost and
tracking doesn’t get correctly applied. Because Raqm doesn’t expose the
HarfBuzz buffer to the outside, my app can’t call hb_font_set_ptem()
directly.

Personally, I wonder if HarfBuzz [2] or perhaps Raqm should be changed so
they retrieve the nominal point size from the FT_Face. Then, apps wouldn’t
have to bother with the complexity of telling HarfBuzz about the nominal
size of the text being rendered, which they’ve already passed to FreeType
as char_height argument to FT_Set_Char_Size().

Anyhow, it’s not clear to me how to reliably retrieve the nominal point
size from an FT_Face, especially given the multiple ways of requesting
sizes from FreeType. Hence the question.

[1] https://github.com/unicode-org/text-rendering-tests
[2] https://github.com/harfbuzz/harfbuzz/issues/1269

Thanks,

— Sascha


reply via email to

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