diff options
author | Grigori Goronzy <greg@chown.ath.cx> | 2015-05-23 13:20:55 +0200 |
---|---|---|
committer | Grigori Goronzy <greg@chown.ath.cx> | 2015-07-10 10:42:41 +0200 |
commit | e65d7bb948d3a25a7d73bcfb3b9a799425c0319a (patch) | |
tree | 2cbf5cef235f1b92b23f720b90883f1fc26d8bf4 | |
parent | 77e5a13e503e22ab3df0a08a78a1fbf435c7f6cb (diff) | |
download | libass-e65d7bb948d3a25a7d73bcfb3b9a799425c0319a.tar.bz2 libass-e65d7bb948d3a25a7d73bcfb3b9a799425c0319a.tar.xz |
directwrite: add 'width' attribute
This is required for proper font matching.
-rw-r--r-- | libass/ass_directwrite.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/libass/ass_directwrite.cpp b/libass/ass_directwrite.cpp index f00b7b8..415afef 100644 --- a/libass/ass_directwrite.cpp +++ b/libass/ass_directwrite.cpp @@ -148,6 +148,11 @@ static void destroy_font(void *data) free(priv); } +static int map_width(int stretch) +{ + return stretch * (100 / DWRITE_FONT_STRETCH_MEDIUM); +} + static void scan_fonts(IDWriteFactory *factory, ASS_FontProvider *provider) { HRESULT hr = S_OK; @@ -187,6 +192,7 @@ static void scan_fonts(IDWriteFactory *factory, ASS_FontProvider *provider) return; meta.weight = font->GetWeight(); + meta.width = map_width(font->GetStretch()); font->GetMetrics(&metrics); style = font->GetStyle(); meta.slant = (style==DWRITE_FONT_STYLE_NORMAL)? FONT_SLANT_NONE: |