Created
October 30, 2025 18:19
-
-
Save loic-sharma/ba2872f784f016682e38b5d20f0c460f to your computer and use it in GitHub Desktop.
Impact of letter spacing on Arabic text
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class ParagraphSlide0 : public ParagraphSlide_Base { | |
| public: | |
| ParagraphSlide0() { fName = "Paragraph0"; } | |
| void draw(SkCanvas* canvas) override { | |
| canvas->drawColor(SK_ColorWHITE); | |
| auto multiplier = 5.67; | |
| const char* text = "English English\n\nمرحبا بالعالم"; | |
| auto fontCollection = sk_make_sp<FontCollection>(); | |
| fontCollection->setDefaultFontManager(ToolUtils::TestFontMgr()); | |
| fontCollection->enableFontFallback(); | |
| ParagraphStyle paragraph_style; | |
| paragraph_style.turnHintingOff(); | |
| ParagraphBuilderImpl builder(paragraph_style, fontCollection, get_unicode()); | |
| TextStyle text_style; | |
| text_style.setFontFamilies({SkString("Roboto"), | |
| SkString("Noto Color Emoji"), | |
| SkString("Noto Serif CJK JP")}); | |
| text_style.setFontSize(10 * multiplier); | |
| text_style.setLetterSpacing(10); | |
| text_style.setWordSpacing(0); | |
| text_style.setColor(SK_ColorBLACK); | |
| text_style.setHeight(1); | |
| builder.pushStyle(text_style); | |
| builder.addText(text, strlen(text)); | |
| builder.pop(); | |
| auto paragraph = builder.Build(); | |
| paragraph->layout(this->size().width()); | |
| paragraph->paint(canvas, 0, 0); | |
| } | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment