boolean (String mainSubFamily, String italicSubFamily) { String main = mainSubFamily.toLowerCase(Locale.ENGLISH); String candidate = italicSubFamily.toLowerCase(Locale.ENGLISH); // assuming italic variant is named by adding a suffix to the base variant for (String suffix : ITALIC_NAMES) { if (candidate.endsWith(suffix)) { candidate = candidate.substring(0, candidate.length() - suffix.length()).trim(); break; } } return candidate.equals(main) || // 'Regular' is a special case, // corresponding italic variant is usually called 'Italic', not 'Regular Italic' "regular".equals(main) && candidate.isEmpty(); }