IFACEMETHODIMP TextAnalysis::SetBidiLevel( UINT32 textPosition, UINT32 textLength, UINT8 explicitLevel, UINT8 resolvedLevel ) { try { SetCurrentRun(textPosition); SplitCurrentRun(textPosition); while (textLength > 0) { LinkedRun& run = FetchNextRun(&textLength); run.bidiLevel = resolvedLevel; run.isReversed = !!(resolvedLevel & 1); } } catch (...) { return E_FAIL; // Unknown error, probably out of memory. } return S_OK; }
IFACEMETHODIMP TextAnalysis::SetScriptAnalysis(UINT32 textPosition, UINT32 textLength, DWRITE_SCRIPT_ANALYSIS const* scriptAnalysis) { SetCurrentRun(textPosition); SplitCurrentRun(textPosition); while (textLength > 0) { Run *run = FetchNextRun(&textLength); run->mScript = *scriptAnalysis; } return S_OK; }
IFACEMETHODIMP TextAnalysis::SetBidiLevel(UINT32 textPosition, UINT32 textLength, UINT8 explicitLevel, UINT8 resolvedLevel) { SetCurrentRun(textPosition); SplitCurrentRun(textPosition); while (textLength > 0) { Run *run = FetchNextRun(&textLength); run->mBidiLevel = resolvedLevel; } return S_OK; }
IFACEMETHODIMP TextAnalysis::SetNumberSubstitution( UINT32 textPosition, UINT32 textLength, IDWriteNumberSubstitution* numberSubstitution ) { try { SetCurrentRun(textPosition); SplitCurrentRun(textPosition); while (textLength > 0) { LinkedRun& run = FetchNextRun(&textLength); run.isNumberSubstituted = (numberSubstitution != nullptr); } } catch (...) { return E_FAIL; // Unknown error, probably out of memory. } return S_OK; }
IFACEMETHODIMP TextAnalysis::SetScriptAnalysis( UINT32 textPosition, UINT32 textLength, DWRITE_SCRIPT_ANALYSIS const* scriptAnalysis ) { try { SetCurrentRun(textPosition); SplitCurrentRun(textPosition); while (textLength > 0) { LinkedRun& run = FetchNextRun(&textLength); run.script = *scriptAnalysis; } } catch (...) { return E_FAIL; // Unknown error, probably out of memory. } return S_OK; }
IFACEMETHODIMP TextAnalysis::SetGlyphOrientation( UINT32 textPosition, UINT32 textLength, DWRITE_GLYPH_ORIENTATION_ANGLE glyphOrientationAngle, UINT8 adjustedBidiLevel, BOOL isSideways, BOOL isRightToLeft ) { try { // Mapping from angle down to small orientation. const static UINT8 glyphOrientations[] = { GlyphOrientationCW0, GlyphOrientationCW90, GlyphOrientationCW180, GlyphOrientationCW270, }; SetCurrentRun(textPosition); SplitCurrentRun(textPosition); while (textLength > 0) { LinkedRun& run = FetchNextRun(&textLength); run.glyphOrientation = glyphOrientations[glyphOrientationAngle & 3]; run.isSideways = !!isSideways; run.isReversed = !!isRightToLeft; run.bidiLevel = adjustedBidiLevel; } } catch (...) { return E_FAIL; // Unknown error, probably out of memory. } return S_OK; }