X-Git-Url: https://git.saurik.com/apple/icu.git/blobdiff_plain/729e4ab9bc6618bc3d8a898e575df7f4019e29ca..f3c0d7a59d99c2a94c6b8822291f0e42be3773c9:/icuSources/layoutex/ParagraphLayout.cpp diff --git a/icuSources/layoutex/ParagraphLayout.cpp b/icuSources/layoutex/ParagraphLayout.cpp index dcfa3e42..9e525cf1 100644 --- a/icuSources/layoutex/ParagraphLayout.cpp +++ b/icuSources/layoutex/ParagraphLayout.cpp @@ -1,6 +1,8 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html /* ********************************************************************** - * Copyright (C) 2002-2010, International Business Machines + * Copyright (C) 2002-2014, International Business Machines * Corporation and others. All Rights Reserved. ********************************************************************** */ @@ -332,6 +334,9 @@ ParagraphLayout::ParagraphLayout(const LEUnicode chars[], le_int32 count, return; } + (void)copyright; // Suppress unused variable warning. + (void)fVertical; // Suppress warning for unused field fVertical. + // FIXME: should check the limit arrays for consistency... computeLevels(paragraphLevel); @@ -357,7 +362,7 @@ ParagraphLayout::ParagraphLayout(const LEUnicode chars[], le_int32 count, le_int32 styleCount = sizeof styleRunArrays / sizeof styleRunArrays[0]; StyleRuns styleRuns(styleRunArrays, styleCount); LEErrorCode layoutStatus = LE_NO_ERROR; - + fStyleRunCount = styleRuns.getRuns(NULL, NULL); fStyleRunLimits = LE_NEW_ARRAY(le_int32, fStyleRunCount); @@ -380,7 +385,7 @@ ParagraphLayout::ParagraphLayout(const LEUnicode chars[], le_int32 count, } else { // initialize - for (runStart = 0, run = 0; run < fStyleRunCount; run += 1) { + for (run = 0; run < fStyleRunCount; run += 1) { fStyleRunInfo[run].font = NULL; fStyleRunInfo[run].runBase = 0; fStyleRunInfo[run].runLimit = 0; @@ -425,7 +430,7 @@ ParagraphLayout::ParagraphLayout(const LEUnicode chars[], le_int32 count, } // Make big arrays for the glyph widths, glyph-to-char and char-to-glyph maps, - // in logical order. (Both maps need an extra entry for the end of the text.) + // in logical order. (Both maps need an extra entry for the end of the text.) // // For each layout get the positions and convert them into glyph widths, in // logical order. Get the glyph-to-char mapping, offset by starting index in the @@ -435,7 +440,7 @@ ParagraphLayout::ParagraphLayout(const LEUnicode chars[], le_int32 count, fGlyphToCharMap = LE_NEW_ARRAY(le_int32, fGlyphCount + 1); fCharToMinGlyphMap = LE_NEW_ARRAY(le_int32, fCharCount + 1); fCharToMaxGlyphMap = LE_NEW_ARRAY(le_int32, fCharCount + 1); - if ((fGlyphWidths == NULL) || (fGlyphToCharMap == NULL) || + if ((fGlyphWidths == NULL) || (fGlyphToCharMap == NULL) || (fCharToMinGlyphMap == NULL) || (fCharToMaxGlyphMap == NULL)) { status = LE_MEMORY_ALLOCATION_ERROR; return; @@ -450,7 +455,7 @@ ParagraphLayout::ParagraphLayout(const LEUnicode chars[], le_int32 count, fStyleRunInfo[run].glyphs = LE_NEW_ARRAY(LEGlyphID, glyphCount); fStyleRunInfo[run].positions = LE_NEW_ARRAY(float, glyphCount * 2 + 2); - if ((fStyleRunInfo[run].glyphs == NULL) || + if ((fStyleRunInfo[run].glyphs == NULL) || (fStyleRunInfo[run].positions == NULL)) { status = LE_MEMORY_ALLOCATION_ERROR; return; @@ -608,7 +613,7 @@ ParagraphLayout::~ParagraphLayout() } } - + le_bool ParagraphLayout::isComplex(const LEUnicode chars[], le_int32 count) { UErrorCode scriptStatus = U_ZERO_ERROR; @@ -1088,7 +1093,7 @@ void ParagraphLayout::appendRun(ParagraphLayout::Line *line, le_int32 run, le_in // previous run, even though this glyph may be in the middle of the // run. fVisualRunLastX -= fStyleRunInfo[run].positions[leftGlyph * 2]; - + // Make rightGlyph be the glyph just to the right of // the run's glyphs rightGlyph += 1; @@ -1202,7 +1207,7 @@ le_int32 ParagraphLayout::Line::getWidth() const le_int32 glyphCount = lastRun->getGlyphCount(); const float *positions = lastRun->getPositions(); - + return (le_int32) positions[glyphCount * 2]; }