From e7544575d027df24762cd2eb1f37eaaefdcd0a35 Mon Sep 17 00:00:00 2001 From: Dmitry Batrak Date: Mon, 11 Jan 2016 20:02:03 +0300 Subject: [PATCH] correct font file name matching for Hasklig italics --- .../com/intellij/openapi/editor/impl/FontInfo.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/FontInfo.java b/platform/platform-impl/src/com/intellij/openapi/editor/impl/FontInfo.java index 2dec93047231..0b635b21e7ab 100644 --- a/platform/platform-impl/src/com/intellij/openapi/editor/impl/FontInfo.java +++ b/platform/platform-impl/src/com/intellij/openapi/editor/impl/FontInfo.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2015 JetBrains s.r.o. + * Copyright 2000-2016 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -116,7 +116,7 @@ public class FontInfo { String normalizedName = name.toLowerCase(Locale.getDefault()); return normalizedName.startsWith(normalizedFamilyName) && (normalizedName.endsWith(".otf") || normalizedName.endsWith(".ttf")) && - (style == -1 || style == ComplementaryFontsRegistry.getFontStyle(name)); + (style == -1 || style == getFontStyle(normalizedName)); } }; List files = new ArrayList(); @@ -143,6 +143,13 @@ public class FontInfo { return Collections.min(files, BY_NAME); } + private static int getFontStyle(@NotNull String fontFileNameLowercase) { + String baseName = fontFileNameLowercase.substring(0, fontFileNameLowercase.length() - 4); + if (baseName.endsWith("-it")) return Font.ITALIC; + else if (baseName.endsWith("-boldit")) return Font.BOLD | Font.ITALIC; + else return ComplementaryFontsRegistry.getFontStyle(fontFileNameLowercase); + } + private void parseProblemGlyphs() { myCheckedForProblemGlyphs = true; BufferedImage buffer = UIUtil.createImage(20, 20, BufferedImage.TYPE_INT_RGB);