Question

I installed Monaco font using this code. However, it doesn't appear in Setting -> Editor -> Color and fonts -> Font. What should I do?

Was it helpful?

Solution 2

Try to install fonts in another way. Just use the Font Viewer.

enter image description here

I use IDEA under ElementaryOS and it works for me.

Update:

enter image description here

OTHER TIPS

You need to create a folder monaco in directory /usr/share/fonts/truetype/

and copy the font 'monaco.ttf' into this folder.

Then, run fc-cache -v -f

I had the similar problems recently. The reason IDEA could not find the font might be the installing location of the fonts not correct.

At the beginning, my font was put under ~/.fonts, the font name not show in IDEA settings. Then I put a copy of the font to .local/share/fonts, and with command fc-cache -v -f to refresh the cache, the font name can be selected in IDEA font settings.

Hope it would be helpful.

enter image description here

In IntelliJ settings you can change only Editor Pane's font. But you can set any font available in your system to any IntelliJ UI component.If you want to be in control of entire IDE (Project tree, Menu Bar, Labels, etc) create simple plugin with this line of code in it: UIManager.put("XXX.font", new Font("fontName", style, size)) where XXX is name of UI component like Label, TextField, Tree, etc.). Full list of Swing components (IntelliJ built using Swing framework) you can find here: List of Java Swing UI properties? After executing plugin all new font settings will be applied to IntelliJ's UI. Here is the code sample:

import com.intellij.openapi.project.Project;
import com.intellij.openapi.wm.ToolWindow;
import com.intellij.openapi.wm.ToolWindowFactory;
import com.intellij.ui.content.Content;
import com.intellij.ui.content.ContentFactory;

import javax.swing.*;
import java.awt.*;

public class MyUIPlugin implements ToolWindowFactory
{

    private ToolWindow myToolWindow;

    public static final String TOOL_WINDOW_ID = "MyUISettings";

    public MyUIPlugin() {}

    // Create the tool window content.
    public void createToolWindowContent(final Project project, final ToolWindow toolWindow) {
        myToolWindow = toolWindow;
        this.createContent(toolWindow);
}

public void createContent(final ToolWindow toolWindow) {
    final ContentFactory contentFactory = toolWindow.getContentManager().getFactory();
    JLabel myPluginUI = new JLabel("This is empty panel with my custom fonts settings behind it");
    final Content content = contentFactory.createContent(myPluginUI, "", true);
    toolWindow.getContentManager().addContent(content);
    UIManager.put("TextField.font", new Font(...));
    UIManager.put("List.font", new Font(...));
    UIManager.put("Label.font", new Font(...));
    UIManager.put("Button.font", new Font(...));
    .....
    SwingUtilities.updateComponentTreeUI(myPluginUI);
}

}

Additionally you even can write small Swing code instead of JLabel placeholder, with list of UI elements and list of all fonts available in the system by calling GraphicsEnvironment.getLocalGraphicsEnvironment().getAllFonts(). And you can assign different font to different component types right in your plugin window and have full customization of IntelliJ UI fonts.

I solved this issue by following the instructions and installing it from this repo: https://github.com/probil/Monaco-IDE-font.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top