That said, I think your algorithm is good enough, and fast enough for the use case you have in mind (and I've just verified that on my machine with my strange fonts, it's also very usable). As I already said in the comments, results are really poor when trying to use non-math fonts in math. The main math font is still Latin Modern Math but letters, Greek, mathematical operator, and double struck digits, of course, are taken from DejaVu via fallback. But that's what would be needed to do a proper job in all cases. Here is a minimal example which uses DejaVu Sans for math. I'd be hesitant to stick such a monster in the drawing code. something that goes through the font, extracts the ligatures, or takes a list from the user, and then uses some kind of hash trick to check if there's a match in the current string to be printed. I don't think we can prevent people to shoot themselves in the foot on slow machines unless we go for something that's a bit heavier on data structures, e.g. Well, in any case, your new code is certainly no worse than the code I originally proposed. But for anything but a very short ligature string (I guess 2-4 characters), the bitmap is going to beat the memchr version because memchr contains a loop. Show what exactly? If you are wondering about memchr vs the bitmap approach, I can run a quick valgrind or something, if that helps. Bit compare trough array or bitmap equivalent is quick, comparing two strings is very CPU intensive. Pragmata Pro is the first monospaced typeface to offer precise glyph positioning in common programming keywords, enabled by default in editors that support OpenType GPOS table. Practically a giant who run like a cheetah Java and C/C++ reserved keywords are now kerned. I am very cautious about searching trough lists in tight screen drawing loop. Now Pragmata Pro, with its 9437 glyphs, can be loaded in a few µs. Please show that somewhere when you get time. Okay, with user-tunable ligature string (and the bitmap thing I proposed)
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |