Feature: drop ICU-lx in favour of directly interfacing with harfbuzz

This means we have RTL support again with ICU 58+. It makes use of:
- ICU for bidi-itemization
- ICU for script-itemization
- OpenTTD for style-itemization
- harfbuzz for shaping
This commit is contained in:
Patric Stout
2023-04-30 20:37:40 +02:00
committed by Patric Stout
parent 9cb60768fe
commit 81d4fa6999
22 changed files with 1018 additions and 190 deletions

View File

@@ -21,13 +21,6 @@
#include <type_traits>
#include <vector>
#ifdef WITH_ICU_LX
#include "layout/ParagraphLayout.h"
#define ICU_FONTINSTANCE : public icu::LEFontInstance
#else /* WITH_ICU_LX */
#define ICU_FONTINSTANCE
#endif /* WITH_ICU_LX */
/**
* Text drawing parameters, which can change while drawing a line, but are kept between multiple parts
* of the same text, e.g. on line breaks.
@@ -83,30 +76,12 @@ struct FontState {
/**
* Container with information about a font.
*/
class Font ICU_FONTINSTANCE {
class Font {
public:
FontCache *fc; ///< The font we are using.
TextColour colour; ///< The colour this font has to be.
Font(FontSize size, TextColour colour);
#ifdef WITH_ICU_LX
/* Implementation details of LEFontInstance */
le_int32 getUnitsPerEM() const;
le_int32 getAscent() const;
le_int32 getDescent() const;
le_int32 getLeading() const;
float getXPixelsPerEm() const;
float getYPixelsPerEm() const;
float getScaleFactorX() const;
float getScaleFactorY() const;
const void *getFontTable(LETag tableTag) const;
const void *getFontTable(LETag tableTag, size_t &length) const;
LEGlyphID mapCharToGlyph(LEUnicode32 ch) const;
void getGlyphAdvance(LEGlyphID glyph, LEPoint &advance) const;
le_bool getGlyphPoint(LEGlyphID glyph, le_int32 pointNumber, LEPoint &point) const;
#endif /* WITH_ICU_LX */
};
/** Mapping from index to font. */
@@ -183,7 +158,7 @@ public:
/** Item in the linecache */
struct LineCacheItem {
/* Stuff that cannot be freed until the ParagraphLayout is freed */
void *buffer; ///< Accessed by both ICU's and our ParagraphLayout::nextLine.
void *buffer; ///< Accessed by our ParagraphLayout::nextLine.
FontMap runs; ///< Accessed by our ParagraphLayout::nextLine.
FontState state_after; ///< Font state after the line.