summaryrefslogtreecommitdiffstats
path: root/libass/ass_directwrite.c
diff options
context:
space:
mode:
authorOleg Oshmyan <chortos@inbox.lv>2015-10-21 00:51:34 +0300
committerOleg Oshmyan <chortos@inbox.lv>2015-10-23 02:36:53 +0300
commite00691e8096cc69e5651480155ebc61d9e079290 (patch)
treeb097d3c1b8b560b08b6688330434b5c746d12407 /libass/ass_directwrite.c
parent018cfe7b2cbbcd10e7860e7903564b5d5a0b1d16 (diff)
downloadlibass-e00691e8096cc69e5651480155ebc61d9e079290.tar.bz2
libass-e00691e8096cc69e5651480155ebc61d9e079290.tar.xz
fontselect: find fonts with PostScript outlines by PostScript name
Fonts without PostScript outlines (such as TrueType fonts) are unaffected, and their PostScript names continue to be ignored when searching for fonts. This matches the behavior of GDI and hence VSFilter.
Diffstat (limited to 'libass/ass_directwrite.c')
-rw-r--r--libass/ass_directwrite.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/libass/ass_directwrite.c b/libass/ass_directwrite.c
index 6b6b623..8388f1c 100644
--- a/libass/ass_directwrite.c
+++ b/libass/ass_directwrite.c
@@ -483,6 +483,24 @@ static int map_width(enum DWRITE_FONT_STRETCH stretch)
}
}
+static bool is_postscript(IDWriteFont *font)
+{
+ HRESULT hr = S_OK;
+ IDWriteFontFace *face = NULL;
+ DWRITE_FONT_FACE_TYPE type;
+
+ hr = IDWriteFont_CreateFontFace(font, &face);
+ if (FAILED(hr) || !face)
+ return false;
+
+ type = IDWriteFontFace_GetType(face);
+ IDWriteFontFace_Release(face);
+
+ return type == DWRITE_FONT_FACE_TYPE_CFF ||
+ type == DWRITE_FONT_FACE_TYPE_RAW_CFF ||
+ type == DWRITE_FONT_FACE_TYPE_TYPE1;
+}
+
/*
* Scan every system font on the current machine and add it
* to the libass lookup. Stores the FontPrivate as private data
@@ -616,6 +634,8 @@ static void scan_fonts(IDWriteFactory *factory,
}
IDWriteLocalizedStrings_Release(familyNames);
+ meta.is_postscript = is_postscript(font);
+
FontPrivate *font_priv = (FontPrivate *) calloc(1, sizeof(*font_priv));
font_priv->font = font;