Skip to content

Commit 99183a3

Browse files
committed
Add locale support to dwrite backend
1 parent d07eef9 commit 99183a3

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/hb-directwrite.cc

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -688,14 +688,16 @@ _hb_directwrite_shape(hb_shape_plan_t *shape_plan,
688688

689689
bool backward = HB_DIRECTION_IS_BACKWARD(buffer->props.direction);
690690

691+
wchar_t w_lang[4];
692+
mbstowcs(w_lang, hb_language_to_string(buffer->props.language), 10);
691693
hr = analyzer->GetGlyphs(pchars, length,
692694
fontFace, FALSE,
693695
buffer->props.direction,
694-
&runHead->mScript, NULL, NULL, NULL, NULL, 0,
696+
&runHead->mScript, (const wchar_t*)w_lang, NULL, NULL, NULL, 0,
695697
maxGlyphs, clusters, textProperties,
696698
glyphs, glyphProperties, &actualGlyphs);
697699

698-
if (hr != HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER)) {
700+
if (hr == HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER)) {
699701
free(clusters);
700702
free(glyphs);
701703
free(textProperties);
@@ -711,7 +713,7 @@ _hb_directwrite_shape(hb_shape_plan_t *shape_plan,
711713
hr = analyzer->GetGlyphs(pchars, length,
712714
fontFace, FALSE,
713715
buffer->props.direction,
714-
&runHead->mScript, NULL, NULL, NULL, NULL, 0,
716+
&runHead->mScript, (const wchar_t*)w_lang, NULL, NULL, NULL, 0,
715717
maxGlyphs, clusters, textProperties,
716718
glyphs, glyphProperties, &actualGlyphs);
717719
}

0 commit comments

Comments
 (0)