RTL text segments are now flagged as such

This commit is contained in:
Leon Styhre 2024-08-02 23:36:06 +02:00
parent 09d16e9c16
commit c87d2e7584
2 changed files with 5 additions and 0 deletions

View file

@ -834,6 +834,9 @@ std::vector<Font::ShapeSegment> Font::shapeText(const std::string& text)
hb_buffer_guess_segment_properties(mBufHB); hb_buffer_guess_segment_properties(mBufHB);
hb_shape(segment.fontHB, mBufHB, nullptr, 0); hb_shape(segment.fontHB, mBufHB, nullptr, 0);
if (hb_buffer_get_direction(mBufHB) == HB_DIRECTION_RTL)
segment.rightToLeft = true;
glyphInfo = hb_buffer_get_glyph_infos(mBufHB, &glyphCount); glyphInfo = hb_buffer_get_glyph_infos(mBufHB, &glyphCount);
length = glyphCount; length = glyphCount;
} }

View file

@ -194,6 +194,7 @@ private:
float glyphsWidth; // TEMPORARY float glyphsWidth; // TEMPORARY
hb_font_t* fontHB; hb_font_t* fontHB;
bool doShape; bool doShape;
bool rightToLeft;
std::string substring; std::string substring;
std::vector<unsigned int> glyphIndexes; std::vector<unsigned int> glyphIndexes;
@ -203,6 +204,7 @@ private:
, glyphsWidth {0} // TEMPORARY , glyphsWidth {0} // TEMPORARY
, fontHB {nullptr} , fontHB {nullptr}
, doShape {false} , doShape {false}
, rightToLeft {false}
{ {
} }
}; };