Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changing font has no effect #408

Closed
seghier opened this issue Jun 10, 2023 · 4 comments
Closed

Changing font has no effect #408

seghier opened this issue Jun 10, 2023 · 4 comments
Assignees

Comments

@seghier
Copy link

seghier commented Jun 10, 2023

Hi
I change font in

var pngBytes = formula.RenderToPng(20.0, 0.0, 0.0, "Algerian");

But i don't see any change, why?

And can you add support for thin font like this one

image

@ForNeVeR
Copy link
Owner

Please give the example of the formula you are rendering using this code.

Note that this system font setting only applies to the text section of the formula (i.e. when you use the text{ … } command). Math section can only use hardcoded fonts for now, because the font metrics are impossible to extract automatically for now.

(I'll open a separate feature request, and we'll think of auto-expanding the metrics system to work with any text in formulas later, if your request is about that part; but, to figure that out, we need a formula example.)

@seghier
Copy link
Author

seghier commented Jun 11, 2023

Thank you
Any simple formula
for example:

\begin{align} x+1 &= y + 1 \\ x &= y-1 \end{align}

\binom{n}{k} = \frac{n!}{k!(n-k)!}

f(x) = \cases{1/3 & \mathrm{if} \thinspace 0\le x\le 1;\cr 2/3 & \mathrm{if} \thinspace 3\le x \le 4; \cr 0 & 
\mathrm{elsewhere.}\cr}

I already create two plugins to use them in Rhinoceros 3D and Grasshopper, and i hope if there is a way to export the formula as svg or at least adding support for thin font, because create vector (svg or dxf) from thin font is easier in Rhino

image

@ForNeVeR
Copy link
Owner

For this formula, you can try something like this:

\text{f(x)} = \cases{\text{1/3} & \text{if 0 ≤ x ≤ 1;} \\
\text{2/3} & \text{if 3 ≤ x ≤ 4;} \\
\text{0} & \text{elsewhere.}}

@ForNeVeR
Copy link
Owner

So, I've opened a feature request #411 and found a bug #412 while typing that formula.

This request I consider as answered for now, but feel free to ask any additional questions!

@ForNeVeR ForNeVeR closed this as not planned Won't fix, can't repro, duplicate, stale Jun 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants