[dwrite] Cosmetic change (#963)

This commit is contained in:
Ebrahim Byagowi 2018-04-11 18:00:13 +04:30 committed by GitHub
parent 09d5e54688
commit cb3fa70cd4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 22 deletions

View File

@ -1,4 +1,4 @@
/* /*
* Copyright © 2015-2018 Ebrahim Byagowi * Copyright © 2015-2018 Ebrahim Byagowi
* *
* This is part of HarfBuzz, a text shaping library. * This is part of HarfBuzz, a text shaping library.
@ -304,8 +304,8 @@ public:
inline bool ContainsTextPosition (uint32_t aTextPosition) const inline bool ContainsTextPosition (uint32_t aTextPosition) const
{ {
return aTextPosition >= mTextStart return aTextPosition >= mTextStart &&
&& aTextPosition < mTextStart + mTextLength; aTextPosition < mTextStart + mTextLength;
} }
Run *nextRun; Run *nextRun;
@ -485,11 +485,10 @@ protected:
for (Run *run = &mRunHead; run; run = run->nextRun) for (Run *run = &mRunHead; run; run = run->nextRun)
if (run->ContainsTextPosition (textPosition)) if (run->ContainsTextPosition (textPosition))
{ {
mCurrentRun = run; mCurrentRun = run;
return; return;
} }
//NS_NOTREACHED ("We should always be able to find the text position in one \ // NS_NOTREACHED ("We should always be able to find the text position in one of our runs");
// of our runs");
} }
void SplitCurrentRun (uint32_t splitPosition) void SplitCurrentRun (uint32_t splitPosition)
@ -655,7 +654,7 @@ _hb_directwrite_shape_full (hb_shape_plan_t *shape_plan,
for (unsigned int i = 0; i < num_features; ++i) for (unsigned int i = 0; i < num_features; ++i)
{ {
typographic_features.features[i].nameTag = (DWRITE_FONT_FEATURE_TAG) typographic_features.features[i].nameTag = (DWRITE_FONT_FEATURE_TAG)
hb_uint32_swap (features[i].tag); hb_uint32_swap (features[i].tag);
typographic_features.features[i].parameter = features[i].value; typographic_features.features[i].parameter = features[i].value;
} }
} }
@ -760,27 +759,27 @@ retry_getglyphs:
uint16_t* modifiedGlyphIndices = new uint16_t[maxGlyphCount]; uint16_t* modifiedGlyphIndices = new uint16_t[maxGlyphCount];
float* modifiedGlyphAdvances = new float[maxGlyphCount]; float* modifiedGlyphAdvances = new float[maxGlyphCount];
DWRITE_GLYPH_OFFSET* modifiedGlyphOffsets = DWRITE_GLYPH_OFFSET* modifiedGlyphOffsets =
new DWRITE_GLYPH_OFFSET[maxGlyphCount]; new DWRITE_GLYPH_OFFSET[maxGlyphCount];
uint32_t actualGlyphsCount; uint32_t actualGlyphsCount;
hr = analyzer1->GetJustifiedGlyphs (fontFace, fontEmSize, runHead->mScript, hr = analyzer1->GetJustifiedGlyphs (fontFace, fontEmSize, runHead->mScript,
textLength, glyphCount, maxGlyphCount, clusterMap, glyphIndices, textLength, glyphCount, maxGlyphCount, clusterMap, glyphIndices,
glyphAdvances, justifiedGlyphAdvances, justifiedGlyphOffsets, glyphAdvances, justifiedGlyphAdvances, justifiedGlyphOffsets,
glyphProperties, &actualGlyphsCount, modifiedClusterMap, modifiedGlyphIndices, glyphProperties, &actualGlyphsCount, modifiedClusterMap, modifiedGlyphIndices,
modifiedGlyphAdvances, modifiedGlyphOffsets); modifiedGlyphAdvances, modifiedGlyphOffsets);
if (hr == HRESULT_FROM_WIN32 (ERROR_INSUFFICIENT_BUFFER)) if (hr == HRESULT_FROM_WIN32 (ERROR_INSUFFICIENT_BUFFER))
{ {
maxGlyphCount = actualGlyphsCount; maxGlyphCount = actualGlyphsCount;
delete [] modifiedGlyphIndices; delete [] modifiedGlyphIndices;
delete [] modifiedGlyphAdvances; delete [] modifiedGlyphAdvances;
delete [] modifiedGlyphOffsets; delete [] modifiedGlyphOffsets;
maxGlyphCount = actualGlyphsCount; maxGlyphCount = actualGlyphsCount;
goto retry_getjustifiedglyphs; goto retry_getjustifiedglyphs;
} }
if (FAILED (hr)) if (FAILED (hr))
FAIL ("Analyzer failed to get justified glyphs."); FAIL ("Analyzer failed to get justified glyphs.");
delete [] clusterMap; delete [] clusterMap;
delete [] glyphIndices; delete [] glyphIndices;

View File

@ -30,8 +30,9 @@
HB_BEGIN_DECLS HB_BEGIN_DECLS
HB_EXTERN hb_bool_t HB_EXTERN hb_bool_t
hb_directwrite_shape_experimental_width(hb_font_t *font, hb_buffer_t *buffer, hb_directwrite_shape_experimental_width (hb_font_t *font, hb_buffer_t *buffer,
const hb_feature_t *features, unsigned int num_features, float width); const hb_feature_t *features,
unsigned int num_features, float width);
HB_END_DECLS HB_END_DECLS