Closed jokteur closed 1 year ago
You should not use the font XITSMath-Bold
, this font is not full uni-math supported, remove the following lines should work:
const FontSrcFile math_bold("data/xits/XITSMath-Bold.clm2", "data/xits/XITSMath-Bold.otf");
MicroTeX::addFont(math_bold);
But after adding bold math font should have worked too, I'll fix it later.
I remove math_bold
like you said, but I still don't have italic maths.
I saw that the CLMReader
in the source code is responsible for assigning the correct math symbols. I took xits/XITSMath-Regular.clm2
from the res folder in MicroTeX
. Is it possible that the clm files do not indicate correctly the symbols for italic ?
That's weird, I can't reproduce this issue with the Cairo
impl. If you don't mind, could you make a PR for your impl?
ImGui requires utf8 when drawing text. So I passed the utf8 codes instead of the glyphId
, meaning that italic got converted into regular. Example: s regular is 115 utf8 and 116 glyphId
, and s italic is 115 utf8 and 2519 glyphId
.
I need to look into on how to fetch characters with glyphId
in ImGui. I may have to touch ImGui internals.
Oh, I see. If you compiled with option -DGLYPH_RENDER_TYPE=0
(that means draw glyphs use graphical-path and typeface both, defaults to 0), you can switch to path rendering to check if it works, add the following code to achieve it:
MicroTeX::setRenderGlyphUsePath(true);
In the end, I used MicroTeX::setRenderGlyphUsePath(true);
and cairo for the rendering.
Other solutions for the moment were not practical. I may one day write a simple library agnostic renderer for microtex.
Hi,
I have posted a few issues already here, but this is more like because I am trying to figure out this library by myself. I have more or less implemented MicroTex with ImGui, and now I am trying to work some kinks out.
So, I am using the XITS font family, and I am manually declaring it like so (I don't use the HAVE_AUTO_FONT_FIND flag):
So, I am expecting that MicroTeX should be able to figure out when to apply bold, when to apply italic. This already works fine for normal text:![image](https://user-images.githubusercontent.com/25845695/188172316-a7b5523f-45f3-4b68-9241-422be1570b8b.png)
\textit{Hello, }\textbf{world}
gives meHowever, when using math symbols:
instead of something like:
![image](https://user-images.githubusercontent.com/25845695/188172728-6a3b7847-a975-45c9-ac47-fd270e66168f.png)
dV = \mathbf{g}_{(i)}\cdot (\mathbf{g}_{(j)}\times \mathbf{g}_{(k)})d\xi_id\xi_jd\xi_k
gives meWhat am I doing wrong ? Clearly, the loading of different fonts works in my implementation as illustrated by the hello world example. Also, when I look into the charmap of![image](https://user-images.githubusercontent.com/25845695/188173427-8cb92c25-0e9c-450f-ac69-b60007dd47cb.png)
XITSMath-Regular
, the italic symbols are there, for example xi: