int (LookupElement item, final Color foreground, LookupElementPresentation presentation, int allowedWidth) { boolean bold = presentation.isItemTextBold(); Font customItemFont = getCustomFont(item, bold, CUSTOM_NAME_FONT); myNameComponent.setFont(customItemFont != null ? customItemFont : bold ? myBoldFont : myNormalFont); int style = getStyle(presentation.isStrikeout(), presentation.isItemTextUnderlined(), presentation.isItemTextItalic()); final FontMetrics metrics = getRealFontMetrics(item, bold, CUSTOM_NAME_FONT); final String name = trimLabelText(presentation.getItemText(), allowedWidth, metrics); int used = getStringWidth(name, metrics); renderItemName(item, foreground, style, name, myNameComponent, presentation.getItemNameDecorations()); return used; }