ScerIO / icon_font_generator

☣️ Flutter Icon Font Generator
https://pub.dev/packages/icon_font_generator
Other
96 stars 50 forks source link

What's the point of ttf? #2

Closed quetool closed 4 years ago

quetool commented 4 years ago

Hi, that's the question. For what is user the generated .ttf?

SergeShkurko commented 4 years ago

@quetool similarly implemented standard Material & Cupertino icons in flutter. If compared with https://pub.dev/packages/flutter_svg using ttf allows you to display icons with less load on the processor and memory, while the icon remains a vectoron and stretches without loss of quality

quetool commented 4 years ago

@SergeShkurko but let me understand, If I use Icon(UiIcons.myIcon) to display an icon, am I using the .ttf or just the IconData generated?

SergeShkurko commented 4 years ago

@quetool IconData - this is the address of the character in the character table (ttf)

GeertJohan commented 4 years ago

The IconData points to the right glyph in the .ttf, so Flutter is using the .ttf to render that glyph. The IconData class (UiIcons in your example), just names the glyph characters so you can use them as Icon(UiIcons.myIcon). The .ttf font contains the actual glyph paths.

quetool commented 4 years ago

@SergeShkurko @GeertJohan but can I use the .ttf in an RichText? That would solve me many troubles...

SergeShkurko commented 4 years ago

@quetool see https://stackoverflow.com/a/56928690/6858892

quetool commented 4 years ago

@SergeShkurko holy mother of ***god! How stupid I am! Thanks!