/** * Search in existed fonts for PostScript name or full font name. * <p> * Note, this method has O(n) complexity. * * @param fontName PostScript or full name. * @return Collection of {@link FontInfo} from set of fonts with given PostScript or full name. */ public Collection<FontInfo> get(String fontName) { if (fontName == null || fontName.length() == 0) { return Collections.<FontInfo>emptyList(); } fontName = fontName.toLowerCase(); List<FontInfo> list = new ArrayList<>(); for (FontInfo fi : getFonts()) { if (fontName.equals(fi.getDescriptor().getFullNameLowerCase()) || fontName.equals(fi.getDescriptor().getFontNameLowerCase())) { list.add(fi); } } return list; }
/** * Search in existed fonts for PostScript name or full font name. * <p> * Note, this method has O(n) complexity. * * @param fontName PostScript or full name. * @return Collection of {@link FontInfo} from set of fonts with given PostScript or full name. */ public Collection<FontInfo> get(String fontName) { if (fontName == null || fontName.length() == 0) { return Collections.<FontInfo>emptyList(); } fontName = fontName.toLowerCase(); List<FontInfo> list = new ArrayList<>(); for (FontInfo fi : getFonts()) { if (fontName.equals(fi.getDescriptor().getFullNameLowerCase()) || fontName.equals(fi.getDescriptor().getFontNameLowerCase())) { list.add(fi); } } return list; }
/** * Search in existed fonts for PostScript name or full font name. * <p> * Note, this method has O(n) complexity. * * @param fontName PostScript or full name. * @return true, if {@link FontSet} contains font with given name. */ public boolean contains(String fontName) { if (fontName == null || fontName.length() == 0) { return false; } fontName = fontName.toLowerCase(); for (FontInfo fi : getFonts()) { if (fontName.equals(fi.getDescriptor().getFullNameLowerCase()) || fontName.equals(fi.getDescriptor().getFontNameLowerCase())) { return true; } } return false; }
/** * Search in existed fonts for PostScript name or full font name. * <p> * Note, this method has O(n) complexity. * * @param fontName PostScript or full name. * @return true, if {@link FontSet} contains font with given name. */ public boolean contains(String fontName) { if (fontName == null || fontName.length() == 0) { return false; } fontName = fontName.toLowerCase(); for (FontInfo fi : getFonts()) { if (fontName.equals(fi.getDescriptor().getFullNameLowerCase()) || fontName.equals(fi.getDescriptor().getFontNameLowerCase())) { return true; } } return false; }