Skip to content

Add capability to fetch alternate glyphs #59

@Kolaru

Description

@Kolaru

Some characters in some fonts have multiple glyph that can represent them. Typically the integral sign in math font has one version for inline math and one one for block equations.

Currently, it looks like the alternate glyph can be retrieved as follow:

julia> font = FTFont("assets/fonts/NewCMMath-Regular.otf")
FTFont(Ptr{FreeType.__JL_FT_FaceRec_} @0x000000001e67a810, true, Dict{Char, FontExtent{Float32}}())

julia> glyph_id = FT_Get_Name_Index(font, "integral.v1")
0x0000172a

julia> res = FT_Load_Glyph(font, glyph_id, FT_LOAD_NO_SCALE)
0

So I guess that adding methods to get_extent, get_extent_internal and load_char to load from a glyph name may do the trick.

Ideally it would be good to retrieve the information on whether a char has alternate glyphs directly from the font, but I am no sure FreeType support that.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions