Changeset - r23006:34630860424f
[Not reviewed]
master
0 2 0
Stefan Strogin - 6 years ago 2018-09-20 20:36:45
stefan.strogin@gmail.com
Fix #6854: Compilation with ICU 62 (#6912)
2 files changed with 10 insertions and 10 deletions:
0 comments (0 inline, 0 general)
src/gfx_layout.cpp
Show inline comments
 
@@ -118,35 +118,35 @@ le_bool Font::getGlyphPoint(LEGlyphID gl
 
}
 

	
 
/**
 
 * Wrapper for doing layouts with ICU.
 
 */
 
class ICUParagraphLayout : public AutoDeleteSmallVector<ParagraphLayouter::Line *, 4>, public ParagraphLayouter {
 
	ParagraphLayout *p; ///< The actual ICU paragraph layout.
 
	icu::ParagraphLayout *p; ///< The actual ICU paragraph layout.
 
public:
 
	/** Visual run contains data about the bit of text with the same font. */
 
	class ICUVisualRun : public ParagraphLayouter::VisualRun {
 
		const ParagraphLayout::VisualRun *vr; ///< The actual ICU vr.
 
		const icu::ParagraphLayout::VisualRun *vr; ///< The actual ICU vr.
 

	
 
	public:
 
		ICUVisualRun(const ParagraphLayout::VisualRun *vr) : vr(vr) { }
 
		ICUVisualRun(const icu::ParagraphLayout::VisualRun *vr) : vr(vr) { }
 

	
 
		const Font *GetFont() const          { return (const Font*)vr->getFont(); }
 
		int GetGlyphCount() const            { return vr->getGlyphCount(); }
 
		const GlyphID *GetGlyphs() const     { return vr->getGlyphs(); }
 
		const float *GetPositions() const    { return vr->getPositions(); }
 
		int GetLeading() const               { return vr->getLeading(); }
 
		const int *GetGlyphToCharMap() const { return vr->getGlyphToCharMap(); }
 
	};
 

	
 
	/** A single line worth of VisualRuns. */
 
	class ICULine : public AutoDeleteSmallVector<ICUVisualRun *, 4>, public ParagraphLayouter::Line {
 
		ParagraphLayout::Line *l; ///< The actual ICU line.
 
		icu::ParagraphLayout::Line *l; ///< The actual ICU line.
 

	
 
	public:
 
		ICULine(ParagraphLayout::Line *l) : l(l)
 
		ICULine(icu::ParagraphLayout::Line *l) : l(l)
 
		{
 
			for (int i = 0; i < l->countRuns(); i++) {
 
				*this->Append() = new ICUVisualRun(l->getVisualRun(i));
 
			}
 
		}
 
		~ICULine() { delete l; }
 
@@ -160,19 +160,19 @@ public:
 
		{
 
			/* ICU uses UTF-16 internally which means we need to account for surrogate pairs. */
 
			return Utf8CharLen(c) < 4 ? 1 : 2;
 
		}
 
	};
 

	
 
	ICUParagraphLayout(ParagraphLayout *p) : p(p) { }
 
	ICUParagraphLayout(icu::ParagraphLayout *p) : p(p) { }
 
	~ICUParagraphLayout() { delete p; }
 
	void Reflow() { p->reflow(); }
 

	
 
	ParagraphLayouter::Line *NextLine(int max_width)
 
	{
 
		ParagraphLayout::Line *l = p->nextLine(max_width);
 
		icu::ParagraphLayout::Line *l = p->nextLine(max_width);
 
		return l == NULL ? NULL : new ICULine(l);
 
	}
 
};
 

	
 
/**
 
 * Helper class to construct a new #ICUParagraphLayout.
 
@@ -193,21 +193,21 @@ public:
 
			buff[0] = ' ';
 
			length = 1;
 
			fontMapping.End()[-1].first++;
 
		}
 

	
 
		/* Fill ICU's FontRuns with the right data. */
 
		FontRuns runs(fontMapping.Length());
 
		icu::FontRuns runs(fontMapping.Length());
 
		for (FontMap::iterator iter = fontMapping.Begin(); iter != fontMapping.End(); iter++) {
 
			runs.add(iter->second, iter->first);
 
		}
 

	
 
		LEErrorCode status = LE_NO_ERROR;
 
		/* ParagraphLayout does not copy "buff", so it must stay valid.
 
		 * "runs" is copied according to the ICU source, but the documentation does not specify anything, so this might break somewhen. */
 
		ParagraphLayout *p = new ParagraphLayout(buff, length, &runs, NULL, NULL, NULL, _current_text_dir == TD_RTL ? UBIDI_DEFAULT_RTL : UBIDI_DEFAULT_LTR, false, status);
 
		icu::ParagraphLayout *p = new icu::ParagraphLayout(buff, length, &runs, NULL, NULL, NULL, _current_text_dir == TD_RTL ? UBIDI_DEFAULT_RTL : UBIDI_DEFAULT_LTR, false, status);
 
		if (status != LE_NO_ERROR) {
 
			delete p;
 
			return NULL;
 
		}
 

	
 
		return new ICUParagraphLayout(p);
src/gfx_layout.h
Show inline comments
 
@@ -19,13 +19,13 @@
 
#include <map>
 
#include <string>
 
#include <stack>
 

	
 
#ifdef WITH_ICU_LAYOUT
 
#include "layout/ParagraphLayout.h"
 
#define ICU_FONTINSTANCE : public LEFontInstance
 
#define ICU_FONTINSTANCE : public icu::LEFontInstance
 
#else /* WITH_ICU_LAYOUT */
 
#define ICU_FONTINSTANCE
 
#endif /* WITH_ICU_LAYOUT */
 

	
 
/**
 
 * Text drawing parameters, which can change while drawing a line, but are kept between multiple parts
0 comments (0 inline, 0 general)