I have implemented react-monaco-editor in my project.
In the overall CSS, I have defined a font family to be used as
Helvetica, Tahoma, Arial, monospace
.
However, I also need to customize the font for a specific editor instance on the page to be "Fira Code", monospace
. I have set this in the Editor's Optional configuration and successfully applied the new font.
The issue arises when the global font is being used to measure the width of the text within the editor, causing errors with renderWhitespace and display indent indicator functionalities. Despite attempting to use monaco.editor.remeasureFonts()
in various methods such as Hooks or before rendering, the problem persists.
I suspect that specifying the font selection for measurement in monaco may hold the solution, but so far I have been unable to find the correct API documentation for this purpose.