Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hb_ft_font_changed behavior question #3754

Closed
Benau opened this issue Jul 25, 2022 · 4 comments
Closed

hb_ft_font_changed behavior question #3754

Benau opened this issue Jul 25, 2022 · 4 comments

Comments

@Benau
Copy link

Benau commented Jul 25, 2022

Hello

It seems that cb5ca6b breaks color emoji rendering:

Currently I do this in supertuxkart

    for (FT_Face face : normal_ttf)
    {
        if (!FT_HAS_COLOR(face) ||
            (FT_HAS_COLOR(face) && face->num_fixed_sizes == 0))
        {
            checkFTError(FT_Set_Pixel_Sizes(face, 0, m_shaping_dpi),
                "setting DPI");
        }
        m_hb_fonts.push_back(hb_ft_font_create(face, NULL));

I have to manually do a FT_Select_Size(face, face->num_fixed_sizes - 1) for Noto Color emoji, otherwise the ft_glyph is 'empty' (bits->width / height is zero) (from hb-ft.cc it seems that hb_ft_font_changed is called after hb_ft_font_create)

Or the correct behavior of using hb_ft_font_create is to set pixel / fixed size after that (and manually call hb_ft_font_changed)?

    for (FT_Face face : normal_ttf)
    {
        m_hb_fonts.push_back(hb_ft_font_create(face, NULL));
        if (!FT_HAS_COLOR(face) ||
            (FT_HAS_COLOR(face) && face->num_fixed_sizes == 0))
        {
            checkFTError(FT_Set_Pixel_Sizes(face, 0, m_shaping_dpi),
                "setting DPI");
        }
        if (face->num_fixed_sizes != 0)
        {
            checkFTError(FT_Select_Size(face, face->num_fixed_sizes - 1),
                "setting color emoji size");
        }
        hb_ft_font_changed(m_hb_fonts.back());
@behdad
Copy link
Member

behdad commented Jul 25, 2022

To be honest with you the FT_Face interaction, specially around bitmap fonts, is a mess. I'll try to understand what's going on and get back to you. :(.

@behdad
Copy link
Member

behdad commented Jul 25, 2022

Unpopular opinion: We should never have written hb-ft. :))

@khaledhosny
Copy link
Collaborator

Absolutely. Now we need a time machine :)

@behdad behdad closed this as completed in 1ac2124 Jul 25, 2022
@behdad
Copy link
Member

behdad commented Jul 25, 2022

Fixed. We'll get a release out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants