Limit GetJustifiedGlyphs only to scripts with custom justification character
This commit is contained in:
parent
32ae9d1b3f
commit
adf20ba0d1
|
@ -815,7 +815,7 @@ retry_getglyphs:
|
|||
}
|
||||
|
||||
// TODO: get lineWith from somewhere
|
||||
FLOAT lineWidth = 15000;
|
||||
FLOAT lineWidth = 60000;
|
||||
|
||||
FLOAT* justifiedGlyphAdvances =
|
||||
(FLOAT*) malloc (maxGlyphCount * sizeof (FLOAT));
|
||||
|
@ -830,6 +830,18 @@ retry_getglyphs:
|
|||
return false;
|
||||
}
|
||||
|
||||
DWRITE_SCRIPT_PROPERTIES scriptProperties;
|
||||
hr = analyzer->GetScriptProperties (runHead->mScript, &scriptProperties);
|
||||
if (FAILED (hr))
|
||||
{
|
||||
FAIL ("Analyzer failed to get script properties.");
|
||||
return false;
|
||||
}
|
||||
uint32_t justificationCharacter = scriptProperties.justificationCharacter;
|
||||
|
||||
// if a script justificationCharacter is not space, it can have GetJustifiedGlyphs
|
||||
if (justificationCharacter != 32)
|
||||
{
|
||||
retry_getjustifiedglyphs:
|
||||
UINT16* modifiedClusterMap = (UINT16*) malloc (maxGlyphCount * sizeof (UINT16));
|
||||
UINT16* modifiedGlyphIndices = (UINT16*) malloc (maxGlyphCount * sizeof (UINT16));
|
||||
|
@ -872,9 +884,19 @@ retry_getjustifiedglyphs:
|
|||
glyphAdvances = modifiedGlyphAdvances;
|
||||
glyphOffsets = modifiedGlyphOffsets;
|
||||
|
||||
free(justificationOpportunities);
|
||||
free(justifiedGlyphAdvances);
|
||||
free(justifiedGlyphOffsets);
|
||||
}
|
||||
else
|
||||
{
|
||||
free(glyphAdvances);
|
||||
free(glyphOffsets);
|
||||
|
||||
glyphAdvances = justifiedGlyphAdvances;
|
||||
glyphOffsets = justifiedGlyphOffsets;
|
||||
}
|
||||
|
||||
free(justificationOpportunities);
|
||||
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in New Issue