1

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!

  • Display text using the font and visually verify if it meets your needs. Maybe something like a [font selector](https://github.com/ggleblanc2/font-selector)? – Gilbert Le Blanc Apr 05 '21 at 11:56
  • That's a really stupid piece of advice. Just run the font through literally any half-decent font engine/checker and check if it supports [the `smcp` feature](https://learn.microsoft.com/en-us/typography/opentype/spec/features_pt#tag-smcp). The whole point of the OpenType spec is that you can check for features without "displaying text" first. – Mike 'Pomax' Kamermans Apr 09 '21 at 04:02

1 Answers1

0

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.

Mike 'Pomax' Kamermans
  • 49,297
  • 16
  • 112
  • 153