answerstu

text rendering - How to determine tab width(in pixels) for non-monospace font?

I'm developing a text renderer library which is similar to FreeType for my game. I don't know how to determine the tab width.When I'm handling control characters, I found a problem, that is my text renderer is not only for monospace fonts but also for non-monospace fonts. I know that for monospace fonts, the width of the tab aligning can be 4 or 8 spaces, depending on the usage of the text renderer (AFAIK, most of the programming IDEs intend tabs to 4 spaces; and for creating tables, the software often intend tabs to 8 spaces). But for non-mono...Read more

text rendering - preferred glyph fallback font

[Problem] When rendering a string of multiple languages, the font selected might not support all glyphs. Is it possible to specify a list of fonts to test the glyph through?[Context] The system is Pango + Fontconfig, my first guess this is something to address at fontconfig level. However from fontconfig spec, I don't see something directly relevant.[Questions]Is this something to be addressed at fontconfig level?I tried to add the below in /etc/fonts/local.conf, and then use "fc-match "FreightSans Pro" -s" to test. It seems working because ...Read more

Rendering Text for Web with Various OpenType Features

I have a set of OTF font files and I need to showcase the fonts by dynamically rendering the text into images with different OpenType features turned on and off. The text will be input by a website user in a manner like here or here.Now, I need an advice on a library that is capable of achieving that. Any language suitable for web development will do (PHP, Python, Ruby whatever).All the OTF fonts currently contain Postscript outlines but I can convert them to contain TTF outlines if there is no other option.I am aware of the Python library for ...Read more