Theodore Hall
Theodore Hall

Reputation: 111

Freetype FT_Load_Glyph: expecting FT_GLYPH_FORMAT_BITMAP, getting FT_GLYPH_FORMAT_OUTLINE

This works as expected when built for x64 and running on the Windows desktop, but not as expected when built for UWP-arm64 and running on the HoloLens:

After verifying that a selected face has a certain predefined bitmap size, I call FTC_Manager_LookupSize(...). When it returns, I verify that the returned FT_Size has the expected properties. Specifically: the FT_Face is Courier New, Regular; the FT_Size_Metrics x_ppem, y_ppem are 21, 21. I verify that the FT_Face and FT_Size objects are connected: (((ftsize->face == ftface) && (ftface->size == ftsize))

I then call FT_Load_Glyph(...) with that face, with load_flags = 0 (FT_LOAD_DEFAULT). I expected the FT_GlyphSlot FT_Glyph_Format to be FT_GLYPH_FORMAT_BITMAP. On the x64 desktop, that's what I get. On the UWP-arm64 HoloLens, I get FT_GLYPH_FORMAT_OUTLINE. The face has both outlines and predefined bitmap sizes; but having specified a specific available size and omitting the FT_LOAD_NO_SCALE and FT_LOAD_NO_BITMAP flags, I expected it to load that BITMAP. Is there something else I can do to force BITMAP?

Another detail: on the x64 desktop, my face-searching function finds MS Gothic, Regular (versus Courier New, Regular), but in both cases the selected FT_Face is available in both outlines and specific bitmap sizes, so that doesn't appear to me to be an important distinction.

Thanks for any insights.

Upvotes: 0

Views: 53

Answers (1)

Theodore Hall
Theodore Hall

Reputation: 111

Solved: I added the FT_LOAD_RENDER flag and now I get FT_GLYPH_FORMAT_BITMAP on the UWP-arm64 HoloLens. From the FreeType documentation, I didn't expect that to be necessary, and on the desktop it doesn't seem to be, but in any case it solved my problem on the HoloLens.

Upvotes: 0

Related Questions