Font anomalies
GavinWraith (26) 1563 posts |
Using NetSurf 3.11 (Dev Cl #5300) on RO5.28 the HTML characters π (π), Δ (Δ), Ω (Ω) ∏ (∏), ∑ (∑), ≤ (≤), ≥ (≥), Ω (Ω) always appear in bold. I am trying to find out why. My Fonts directory contains Cabin, Exo, Fanwood, FanwoodText, FreeMono, FreeSans, FreeSerif, MathPhys, NewHall, Portrhouse, Roboto, RobotoCond, Sassoon, Selwyn, Sidney, Simonetta, and System, but I have been unable to trace the problem to anything in them. RUfl_cache appears to use these along with Trinity and WimpSymbol. So where does NetSurf get its Greek glyphs and mathematical symbols from? What can I do to get a tidy display? I suspect that some Encoding files may be missing some lines somewhere. |
Matthew Phillips (473) 721 posts |
The font handling in NetSurf is done through RUfl, a C library which you can download and study if you wish. Roughly speaking, RUfl scans the fonts to find out which Unicode characters are available in each one. RUfl will render the characters in the chosen font (which will be set up in NetSurf’s choices) but when a glyph is not available in your configured font it will use one of the scanned fonts to substitute. You may be able to work out where the Greek characters are coming from by creating a little example HTML file, loading into NetSurf, and then saving the page as a Draw file, which you can then inspect, either by loading into Draw and selecting the characters to see what the font style is, or by using a text editor. I cannot remember how clever RUfl is about choosing a suitable font for the substitution. I think it is aware of bold and italic, but if the scanned fonts include a bold version that does not have a recognisably bold name, RUfl will get confused. I know that RUfl is not capable of identifying which fonts are serif, sans-serif or typewriter style. I have mulled over how you might improve RUfl’s code to automatically categorise fonts into these three rough groupings by examining the definition of a character like lower case L, which would probably be a single straight line between two points in a sans-serif font, and would be the same width as M in a typewriter font. This would be a nice little enhancement, but I’ve never had time to do try it. Perhaps someone else might be inspired?! |