Font suggestions


#1

hi,

I’m trying to work small with pixel accurate fonts right now, like the ones here http://www.miniml.com/ and I’ve had some issues to get them to display correctly.

let’s take the one called uni 05_53 as example which is supposed to display correctly at 8 point.

1)the following table http://www.reeddesign.co.uk/test/points-pixels.html
suggest an equivalence of 11 pixels, but I had to use 11.01 to get it right (the same for 9pt -> 12.01px or 7.5pt ->10.01px) might be because of the point/pixel approximation or just a boundary effect.

Anyway, some pixel/points utility functions might help.

  1. I had to use Justification::topLeft to make sure that the first character starts on an exact pixel.

Could be useful to have a justification option that would quantize the start of the first character on pixel boundaries so that we could use centred variants without blurring the result.

  1. I’ve tried to serialize it in order to embed it with my application but it only serialize the Glyphs that have been painted on screen. So I have to first draw a full ASCII set before serializing it.

Is there a way to do it automatically with JUCE built without GUI.

  1. any hope that we can directly load TrueType fonts using freetype at some point in the future?

#2

bump


#3

Hmm - that’s a tricky one about the horizontal offset, because it’s all done in floating point, and I wouldn’t want to start clipping everything to integer boundaries just because of this. I could add a flag for it, but really don’t like the idea of cluttering up the justification class with something so specific. Justification is an abstract concept, and shouldn’t need to know anything about implementation-specific hacks like this.

Yes, serialising only does loaded glyphs, but I thought there was a method in there to load all the available glyphs?

And loading TT directly… Well it’s not a priority for me, because it’d be a lot of work and would only be useful for a very small number of applications. I can add it to the to-do-list but unlikely to get done anytime in the forseeable future.


#4

I wasn’t asking to have everything rounded to int, but being able to set a flag that would just tell that the first offset should be rounded should be useful.

Personnaly I prefer dealing with vector fonts without having to worry about pixels and rounding, but sometimes to save space you have to use small pixel accurate fonts and it would be really useful that JUCE could deal with this.

can’t find anything like this in both Font or Typeface

Definitely I understand the time factor argument. However I don’t agree that it would only be useful for a small number of applications. I let you know if I manage to load glyphs into JUCE using freetype.


#5

[quote]I wasn’t asking to have everything rounded to int, but being able to set a flag that would just tell that the first offset should be rounded should be useful.

Personnaly I prefer dealing with vector fonts without having to worry about pixels and rounding, but sometimes to save space you have to use small pixel accurate fonts and it would be really useful that JUCE could deal with this. [/quote]

Sure, I understand, but not sure where something like that would belong…

[quote]
can’t find anything like this in both Font or Typeface [/quote]

…I definitely used to have one of those! Must have got rid of it. Oh well, a for-loop from 0 to 32768, getting each glyph will do the trick just as well.


#6

I’d put it has an optionnal attribute in Typeface or Font

ok thanks, will try that.

otherwise, any idea why I have to use 10.01px instead of 10px to get the appropriate result?


#7

No, don’t know about the rounding error. You could try digging around in FontGlyphAlphaMap::createAlphaMapFromPath, but it looks to me like it rounds the numbers in a sensible way.


#8

I’ve played a little with freetype this afternoon and managed to load Glyphs into juce.

here’s a minimal application I’ve made that displays system fonts and allows saving and loading them in juce Gzip format.
http://mdsp.smartelectronix.com/juce/FontSerializer.zip

I just added the possibility to load from TrueType files using freetype. It’s rather minimal, doesn’t take kerning into account…etc but I hope this proof of concept can help TrueType support finds its way into JUCE.

the interresting bits are in the FreetypeLoader class.


#9

This is excellent.

I’ll be definitely be happy to see this supported.

Good job man.


#10