Issue With Fonts Rendering Too Small

Let me preface this by I need to set JUCE_CORETEXT_AVAILABLE (JUCE_USE_DIRECTWRITE on windows) to 0 in order to be able to change the kerning factor.  When I do this, many fonts, but not all, render a lot smaller (but each character still takes up the same amount of space).  This is easily reproducible in the demo project if you switch between software renderer/OpenGL and the CoreGraphics one).  Fonts like Courier New exhibit this behavior.  Any help or work around here would be greatly appreciated.


Which OS?

OS X 10.10.2 - Also note that OTF fonts seem to work fine,but all TTF and some TTC types do not.

However, I just tried an experiment using GNU Free Font (copying them to ~/Library/Fonts).  It doesn't matter if I use the otf or ttf, they both work correctly with the demo.

Bit of a mystery, but I guess it must be the older font SDK parsing the file wrongly or differently. You probably don't really want to disable CoreText, I'd have thought, it works better than the older APIs.

If I don't disable core text, the setExtraKerningFactor does not work.

oh yes, sorry, you said that. Not sure, really. It sounds to me just like the older APIs aren't doing the right thing with the height, but whether it's something that could be "fixed", I don't know..

I started investigating this again because having coretext off was limiting my font selection too much.  Anyway, can you make the following change to createCFAttributedString() inside of  I need to look if a similar solution is available on windows instead of setting JUCE_USE_DIRECTWRITE=0.

  CFAttributedStringSetAttribute (attribString, CFRangeMake (range.getStart(), range.getLength()),
                                  kCTFontAttributeName, ctFontRef);

  if(f->getExtraKerningFactor() != 0){//ADD THIS
      const float num =f->getExtraKerningFactor() * f->getHeight();
      CFAttributedStringSetAttribute (attribString, CFRangeMake (range.getStart(), range.getLength()),
                                       kCTKernAttributeName, CFNumberCreate (0, kCFNumberFloatType, &num));
  CFRelease (ctFontRef);

Thanks, I'll take a look!

Great.  Thanks.

Also, I should have put a CFRelease for the CFNumberCreate().

Yeah, if you look at my change you'll see I fixed that!