crystal-community / crystal-libraries-needed

A list of libraries that are needed or wanted for the Crystal-Language
141 stars 4 forks source link

Font renderer #111

Open watzon opened 4 years ago

watzon commented 4 years ago

This would be a nice thing to have which could augment the abilities of the stumpy libraries. Currently there's no way to add text to images, but with a font renderer it would be pretty easy to add that ability.

bew commented 4 years ago

Something like #55 or harfbuzz would be great :)

watzon commented 4 years ago

@bew agreed, I remember seeing harfbuzz recently as a suggested repo from github. A wrapper around it would be awesome, although it would also be pretty cool to have a pure Crystal font renderer as well.

bew commented 4 years ago

In stumpy_utils, there is a way to write text, but it's pretty basic compared to the mentioned libs above

https://github.com/stumpycr/stumpy_utils/blob/master/README.md#canvastextx-baseline_y-text-font--pcfparserfont-color--rgbaback

watzon commented 4 years ago

That's cool, I didn't even realize that. Never actually heard of the pcf format.

bew commented 4 years ago

From what I read, text rendering is a hard topic, and I think it would be simpler to wrap a library that does it well instead of re-inventing such a complex wheel..

Also, I read that HarfBuzz is a text shaping engine, and Pango uses it for the display/placement of text, so wrapping Pango would be the best option here (and it's cross-plateform!).

watzon commented 4 years ago

Sounds good to me! Now someone just needs to do it :grin:

hugopl commented 3 years ago

You can acess Pango and/or Harfbuzz using https://github.com/jhass/crystal-gobject, i.e. problem solved. :-)