mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
EA-76903 - IAE: FontPreferences.getSize
This commit is contained in:
@@ -26,8 +26,10 @@ import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.colors.EditorColorsScheme;
|
||||
import com.intellij.openapi.editor.colors.EditorFontType;
|
||||
import com.intellij.openapi.editor.colors.FontPreferences;
|
||||
import com.intellij.openapi.editor.ex.util.EditorUIUtil;
|
||||
import com.intellij.openapi.editor.ex.util.EditorUtil;
|
||||
import com.intellij.openapi.editor.impl.ComplementaryFontsRegistry;
|
||||
import com.intellij.openapi.progress.ProcessCanceledException;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.openapi.util.registry.Registry;
|
||||
@@ -457,8 +459,9 @@ public class LookupCellRenderer implements ListCellRenderer {
|
||||
|
||||
// assume a single font can display all lookup item chars
|
||||
Set<Font> fonts = ContainerUtil.newHashSet();
|
||||
FontPreferences fontPreferences = myLookup.getFontPreferences();
|
||||
for (int i = 0; i < sampleString.length(); i++) {
|
||||
fonts.add(EditorUtil.fontForChar(sampleString.charAt(i), Font.PLAIN, myLookup.getTopLevelEditor()).getFont());
|
||||
fonts.add(ComplementaryFontsRegistry.getFontAbleToDisplay(sampleString.charAt(i), Font.PLAIN, fontPreferences).getFont());
|
||||
}
|
||||
|
||||
eachFont: for (Font font : fonts) {
|
||||
|
||||
@@ -35,6 +35,7 @@ import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.command.CommandProcessor;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.editor.*;
|
||||
import com.intellij.openapi.editor.colors.FontPreferences;
|
||||
import com.intellij.openapi.editor.event.*;
|
||||
import com.intellij.openapi.editor.event.DocumentAdapter;
|
||||
import com.intellij.openapi.project.Project;
|
||||
@@ -106,6 +107,8 @@ public class LookupImpl extends LightweightHint implements LookupEx, Disposable
|
||||
private final List<LookupListener> myListeners = ContainerUtil.createLockFreeCopyOnWriteList();
|
||||
private PrefixChangeListener myPrefixChangeListener = new PrefixChangeListener.Adapter() {};
|
||||
private final LookupPreview myPreview = new LookupPreview(this);
|
||||
// keeping our own copy of editor's font preferences, which can be used in non-EDT threads (to avoid race conditions)
|
||||
private final FontPreferences myFontPreferences = new FontPreferences();
|
||||
|
||||
private long myStampShown = 0;
|
||||
private boolean myShown = false;
|
||||
@@ -138,6 +141,7 @@ public class LookupImpl extends LightweightHint implements LookupEx, Disposable
|
||||
myEditor = InjectedLanguageUtil.getTopLevelEditor(editor);
|
||||
myArranger = arranger;
|
||||
myPresentableArranger = arranger;
|
||||
myEditor.getColorsScheme().getFontPreferences().copyTo(myFontPreferences);
|
||||
|
||||
DaemonCodeAnalyzer.getInstance(myProject).disableUpdateByTimer(this);
|
||||
|
||||
@@ -1164,6 +1168,10 @@ public class LookupImpl extends LightweightHint implements LookupEx, Disposable
|
||||
myPrefixChangeListener = listener;
|
||||
}
|
||||
|
||||
FontPreferences getFontPreferences() {
|
||||
return myFontPreferences;
|
||||
}
|
||||
|
||||
public enum FocusDegree { FOCUSED, SEMI_FOCUSED, UNFOCUSED }
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user