Skip to content

not drawing the complete letter #3

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

Open
Fahad-Alsaidi opened this issue Oct 16, 2019 · 7 comments
Open

not drawing the complete letter #3

Fahad-Alsaidi opened this issue Oct 16, 2019 · 7 comments

Comments

@Fahad-Alsaidi
Copy link

Fahad-Alsaidi commented Oct 16, 2019

When I try to draw letter "H" using the attached font, it appears cut from the end.
out

I don't know where is the problem come from? harfbuzz or cairo ? so I hesitate to report it in main harfbuzz repository.

the font: Edw.zip

@behdad
Copy link
Member

behdad commented Oct 17, 2019

HarfBuzz doesn't draw anything.

@khaledhosny

@khaledhosny
Copy link

Whithout checking the font, the glyph might have a -ve left side bearing and the code that is creating Cairo surface is only taking the glyph advance into account when setting the width.

@khaledhosny
Copy link

This code does not take glyph extents into account.

for (unsigned int i = 0; i < len; i++)
{
width += pos[i].x_advance / 64.;
height -= pos[i].y_advance / 64.;
}
if (HB_DIRECTION_IS_HORIZONTAL (hb_buffer_get_direction(hb_buffer)))
height += FONT_SIZE;
else
width += FONT_SIZE;

@khaledhosny
Copy link

I meant right side bearing.

@behdad
Copy link
Member

behdad commented Oct 18, 2019

That's actually expected. hb-view etc work the same way. User should add more margin if needed.

@Fahad-Alsaidi
Copy link
Author

@khaledhosny how I can add right side bearing automatically?

@khaledhosny
Copy link

Use hb_font_get_glyph_extents() to get the glyph bounding box and use this to calculate the ”ink” extents of the line.

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