Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Hinting around: text demystified

Hinting around: text demystified

What is text? The answer of those who know, and like 90s music, is most likely "baby don't hurt me, don't hurt me, no more". It is often said that text is the most difficult part of a graphics toolkit, and that is for good reasons. In this talk we’re going to give you the tools you need to understand text, and bend this mysterious creature to your will.

From the typography theory behind the fonts system, to the intricacies of supporting Unicode bidirectional text runs, to the typesetting itself, that would be enough to drive someone crazy. And there's still nothing being drawn on screen, with that alone!

Next you'll need to have a text rendering engine that takes care of loading the fonts, laying out the glyphs, taking care of hinting too, and then actually draw them somewhere (let alone doing all this in a performant way).

Still here? Good, then prepare for a journey that will take you through the history, implementation and pain of dealing with text. Behold the amazing powers you’ll acquire, enabling you to tame all kinds of text you’ll see on Android.

---

Video Devoxx 2015: https://www.youtube.com/watch?v=VS7co3TrgKE

---

Did you like the slides? You can also find the Keynote source file here, to learn all the tricks and hacks we used: https://goo.gl/7X9KWo

Note: this deck uses non-system fonts that you will need to properly see the deck, and requires Keynote 6.6 to be opened.

Eugenio Marletti

November 11, 2015
Tweet

More Decks by Eugenio Marletti

Other Decks in Technology

Transcript

  1. a sense of scale View.java (22550 LOCs) Editor.java (5700 LOCs)

    TextView.java + Editor.java (15700 LOCs) EditText.java (150 LOCs)
  2. vs

  3. android.text android.text.style ParcelableSpan Annotation AbsoluteSizeSpan AlignmentSpan BackgroundColorSpan BulletSpan ClickableSpan DrawableMarginSpan

    EasyEditSpan ForegroundColorSpan IconMarginSpan ImageSpan LeadingMarginSpan LineBackgroundSpan LineHeightSpan LocaleSpan MaskFilterSpan MetricAffectingSpan QuoteSpan RasterizerSpan RelativeSizeSpan ReplacementSpan ScaleXSpan SpellCheckSpan StrikethroughSpan StyleSpan SubscriptSpan SuggestionRangeSpan SuggestionSpan TabStopSpan TextAppearanceSpan TtsSpan TypefaceSpan URLSpan UnderlineSpan WrapTogetherSpan
  4. interface class string span CharSequence String I StringBuilder M Spanned

    SpannedString I I Spannable SpannableString I M Editable SpannableStringBuilder M M
  5. 4.2 ltr, rtl and stuff hi, this is left-to-right راسيلا

    ىلإ نيميلا وه اذه ،ابحرم اي