/** * If the font is set to null, then the font used to display today's date as text will default to * the L&F's Label default font. * * <p>Otherwise, the font used to display today's date is set as given. * * @param font The font to set. */ public void setTodayFont(Font font) { if (font == null && todayFont != null || !font.equals(todayFont)) { todayFont = font; if (isDisplayable()) setupTodayFont(); } }
/** * If the font is set to null, then the title font (for the Month Year title) will default to the * L&F's Label default font. * * <p>Otherwise, the title font is set as given. * * @param font The font to set. */ public void setTitleFont(Font font) { if (font == null && titleFont != null || !font.equals(titleFont)) { titleFont = font; if (isDisplayable()) setupTitleFont(); } }
/** * If the font is set to null, then the day font will default to 9/11th's of the L&F's Button * default font. * * <p>Otherwise, the day font is set as given. * * @param font The font to set. */ public void setDayFont(Font font) { if (font == null && dayFont != null || !font.equals(dayFont)) { dayFont = font; if (isDisplayable()) setupDayFonts(); } }
@Nullable Font getFontAbleToDisplay(LookupElementPresentation p) { String sampleString = p.getItemText() + p.getTailText() + p.getTypeText(); // assume a single font can display all lookup item chars Set<Font> fonts = ContainerUtil.newHashSet(); for (int i = 0; i < sampleString.length(); i++) { fonts.add( EditorUtil.fontForChar(sampleString.charAt(i), Font.PLAIN, myLookup.getEditor()) .getFont()); } eachFont: for (Font font : fonts) { if (font.equals(myNormalFont)) continue; for (int i = 0; i < sampleString.length(); i++) { if (!font.canDisplay(sampleString.charAt(i))) { continue eachFont; } } return font; } return null; }