mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-04-05 07:15:30 -04:00
font: underline/strikeout: use y-scale, not x-scale
This commit is contained in:
parent
ae91c53fb2
commit
f358211904
1 changed files with 9 additions and 9 deletions
18
font.c
18
font.c
|
|
@ -52,15 +52,15 @@ static void
|
||||||
underline_strikeout_metrics(struct font *font)
|
underline_strikeout_metrics(struct font *font)
|
||||||
{
|
{
|
||||||
FT_Face ft_face = font->face;
|
FT_Face ft_face = font->face;
|
||||||
double x_scale = ft_face->size->metrics.x_scale / 65526.;
|
double y_scale = ft_face->size->metrics.y_scale / 65526.;
|
||||||
double height = ft_face->size->metrics.height / 64;
|
double height = ft_face->size->metrics.height / 64.;
|
||||||
double descent = ft_face->size->metrics.descender / 64;
|
double descent = ft_face->size->metrics.descender / 64.;
|
||||||
|
|
||||||
LOG_DBG("ft: x-scale: %f, height: %f, descent: %f",
|
LOG_DBG("ft: y-scale: %f, height: %f, descent: %f",
|
||||||
x_scale, height, descent);
|
y_scale, height, descent);
|
||||||
|
|
||||||
font->underline.position = round(ft_face->underline_position * x_scale / 64.);
|
font->underline.position = round(ft_face->underline_position * y_scale / 64.);
|
||||||
font->underline.thickness = ceil(ft_face->underline_thickness * x_scale / 64.);
|
font->underline.thickness = ceil(ft_face->underline_thickness * y_scale / 64.);
|
||||||
|
|
||||||
if (font->underline.position == 0.) {
|
if (font->underline.position == 0.) {
|
||||||
font->underline.position = round(descent / 2.);
|
font->underline.position = round(descent / 2.);
|
||||||
|
|
@ -72,8 +72,8 @@ underline_strikeout_metrics(struct font *font)
|
||||||
|
|
||||||
TT_OS2 *os2 = FT_Get_Sfnt_Table(ft_face, ft_sfnt_os2);
|
TT_OS2 *os2 = FT_Get_Sfnt_Table(ft_face, ft_sfnt_os2);
|
||||||
if (os2 != NULL) {
|
if (os2 != NULL) {
|
||||||
font->strikeout.position = round(os2->yStrikeoutPosition * x_scale / 64.);
|
font->strikeout.position = round(os2->yStrikeoutPosition * y_scale / 64.);
|
||||||
font->strikeout.thickness = ceil(os2->yStrikeoutSize * x_scale / 64.);
|
font->strikeout.thickness = ceil(os2->yStrikeoutSize * y_scale / 64.);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (font->strikeout.position == 0.) {
|
if (font->strikeout.position == 0.) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue