summaryrefslogtreecommitdiffstats
path: root/libass/ass_font.c
diff options
context:
space:
mode:
authorrcombs <rcombs@rcombs.me>2023-01-22 15:56:52 -0600
committerOleg Oshmyan <chortos@inbox.lv>2023-02-17 00:09:18 +0200
commite50e0002f5567d6005ce61ca8a469a1dae57d10f (patch)
tree934e48d54a03148610e30b87714440de1273d4be /libass/ass_font.c
parent6f026e0e5517cbf5873fe827207afa34a5551e03 (diff)
downloadlibass-e50e0002f5567d6005ce61ca8a469a1dae57d10f.tar.bz2
libass-e50e0002f5567d6005ce61ca8a469a1dae57d10f.tar.xz
ass_font: match GDI's faux-italics
GDI uses this same matrix.
Diffstat (limited to 'libass/ass_font.c')
-rw-r--r--libass/ass_font.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/libass/ass_font.c b/libass/ass_font.c
index de59c7f..edf42b0 100644
--- a/libass/ass_font.c
+++ b/libass/ass_font.c
@@ -560,6 +560,21 @@ static void ass_glyph_embolden(FT_GlyphSlot slot)
}
/**
+ * Slightly italicize a glyph
+ */
+static void ass_glyph_italicize(FT_GlyphSlot slot)
+{
+ FT_Matrix xfrm = {
+ .xx = 0x10000L,
+ .yx = 0x00000L,
+ .xy = 0x05700L,
+ .yy = 0x10000L,
+ };
+
+ FT_Outline_Transform(&slot->outline, &xfrm);
+}
+
+/**
* \brief Get glyph and face index
* Finds a face that has the requested codepoint and returns both face
* and glyph index.
@@ -662,7 +677,7 @@ bool ass_font_get_glyph(ASS_Font *font, int face_index, int index,
return false;
}
if (!(face->style_flags & FT_STYLE_FLAG_ITALIC) && (font->desc.italic > 55))
- FT_GlyphSlot_Oblique(face->glyph);
+ ass_glyph_italicize(face->glyph);
if (font->desc.bold > ass_face_get_weight(face) + 150)
ass_glyph_embolden(face->glyph);
return true;