Search code examples
javaopentypesmallcaps

Java: Check if otf font file contains small caps glyphs


Is there a way to check if otf font file contains glyphs for small caps variation? Is there a way to do it in java?

Thanks!


Solution

  • There is, just don't use standard-library-Java for it. Use either a Java OpenType font analyser, or do the more sensible thing and consult Freetype2 or Harfbuzz for that information.

    Really, anything that lets you check OpenType features will do: check whether the font encodes for the smcp feature - if it does, it support proper smallcaps as per the OpenType spec. If not, it doesn't, and whatever text engine you're using is going to fake it.