tangram-es icon indicating copy to clipboard operation
tangram-es copied to clipboard

Can render text use CoreText replace Harbuzz freetype In iOS?

Open AceDong0803 opened this issue 3 years ago • 4 comments

I am using tangram-es to draw map in my app, both In Android & iOS, I found the tangram framework make iOS ipa size up 3500kb, the text engine rely on Harbuzz freetype icu,so if I can replace this part to use coretext in iOS,that will reduce the ipa size, I don't determine if it is feasible。Need some advice。thanks a lot。

AceDong0803 avatar Sep 15 '20 12:09 AceDong0803

Using CoreText instead of Harfbuzz on iOS is an appealing idea, I've definitely considered it in the past. However the text layout and rendering backend in Tangram ES is not simple - integrating CoreText would be a large amount of work. I'm also not sure exactly how to implement some parts of our renderer (like rendering individual grapheme clusters as signed distance fields) using CoreText.

matteblair avatar Sep 15 '20 20:09 matteblair

We do part of coretext in alfons: https://github.com/hjanetzek/alfons/pull/14

tallytalwar avatar Sep 17 '20 20:09 tallytalwar

Ok actually now that I've thought about this a bit longer, it might be reasonable to completely drop Harfbuzz, Freetype, and ICU on iOS and use CoreText/CoreGraphics for font layout and rendering instead. This would require some architectural changes to alfons - some functionality that is currently implemented in Tangram ES would probably need to be moved into alfons, or at least moved behind an abstraction of some kind.

This would be a major undertaking, and might introduce some differences in text/font behavior in Tangram ES between Android and iOS. But it would substantially reduce our binary size on iOS and might lead to improved performance and better handling of certain features (like font matching). I'm going to make a plan to try implementing this.

matteblair avatar Oct 12 '20 05:10 matteblair

Ok actually now that I've thought about this a bit longer, it might be reasonable to completely drop Harfbuzz, Freetype, and ICU on iOS and use CoreText/CoreGraphics for font layout and rendering instead. This would require some architectural changes to alfons - some functionality that is currently implemented in Tangram ES would probably need to be moved into alfons, or at least moved behind an abstraction of some kind.

This would be a major undertaking, and might introduce some differences in text/font behavior in Tangram ES between Android and iOS. But it would substantially reduce our binary size on iOS and might lead to improved performance and better handling of certain features (like font matching). I'm going to make a plan to try implementing this.

so exciting about this~

AceDong0803 avatar Oct 12 '20 14:10 AceDong0803