Hi, maybe it is only on my system (Ubuntu 20.04), but using this example:
```
class Example5Text(Scene):
def construct(self):
text = Text('Hello world', font='Source Han Sans').scale(3)
self.add(text)
````
should give this result:

(image is taken from https://github.com/3b1b/manim/pull/680)
However, when I run it on my machine, it only renders the text with the default font.
To distinguish the default font from Source Han Sans, note that the "ll" has no small arc at the bottom in the default font.
Did you install the font Source Han Sans in your computer? Currently, there is no warning for this. You can check whether it is installed using
fc-list
command in Linux.
Possibly fixed by #471 where it uses Pango for rendering where it raises warning if font not found.
I cannot reproduce this either, looks like you might simply be missing the font.
We should treat this as a bug report: "if the font is not installed, no error message is shown"
We should treat this as a bug report: "if the font is not installed, no error message is shown"
That's why I am doing #471 where Pango warns the user if font not installed.
We should still add @cobordism 's suggestion to the current Text, while we wait until the Panel text becomes the default
We should still add @cobordism 's suggestion to the current Text, while we wait until the Panel text becomes the default
It's not possible in Cairo toy api and that's why moving to Pango helps. I would say implementing your idea is not that good, pretty much and it requires a lot of work to make it cross platform.
I suggest to wait until we get Pango for this job.
True, the cairo documentation mentions rather explicitly that cairo does not provide a way to check available fonts:
Selects a family and style of font from a simplified description as a family name, slant and weight. Cairo provides no operation to list available family names on the system (this is a “toy”, remember), but the standard CSS2 generic family names, (“serif”, “sans-serif”, “cursive”, “fantasy”, “monospace”), are likely to work as expected
(Source: https://pycairo.readthedocs.io/en/latest/reference/context.html#cairo.Context.select_font_face)
We can still add an explicit warning to the docstring of Text, and otherwise resolve this via #471 until we switch to Pango.
Now this a duplicate of #393
What I meant is the following:
Text to change font (or do anything else that the dummy Cairo package cannot do), we should issue a warning.I believe @naveen521kk says that his PR will handle point number 2. But I don't think we are handling point number 1.
The PangoText class should issue the correct warnings when fonts aren't installed.
I didn't do any effort to implement the second one. Simply it itself gives the below error message.

Is there anyone how wants to make an example of how to change fonts into the docs?
What happened to all the text examples?
I see only one example here: https://manimce.readthedocs.io/en/latest/examples/text.html
but my completely unrelated PR which was compiled earlier today, still shows 12 examples https://manimce--483.org.readthedocs.build/en/483/examples/text.html
Were all the text examples removed today? and if so, why?
They were moved to the reference https://manimce.readthedocs.io/en/latest/reference/manim.mobject.svg.text_mobject.Text.html
The pr got merged one hour ago, so you can merge the current master into your pr 483, and then these examples will disappear as well on your branch.
@leotrs had the idea of moving them there because they were too specific to Text, but we still have to discuss what we want to show at Text.
Probably something like how to align text, how to transform text, etc.
@cobordism sorry for making that change without asking you. What do you think about this change?
In general, we still have to decide what exactly goes in docstrings (and will be shown in the reference sectio) and what exactly should go in the examples section. Perhaps we should discuss in a separate issue. cc @behackl
Good idea, a few weeks ago I opened https://github.com/ManimCommunity/manim/issues/448, I think here we can discuss what we want to see in the reference and what in the examples.
sorry for making that change without asking you. What do you think about this change?
You didn't have to ask me. I'm all TeX, not Text :)
But what I think.. (a) I didn't realise there was a link to the references from the examples. Unless you're actively looking for it, you won't see it. It should to be more prominent imho.
(b) Reference is where you go to quickly look up something, Examples is where you go to learn. I think most of what we had were of the latter category. I'd expect examples to have examples of text in different sizes, fonts, colours and I'd expect reference to have a complete list of keyword arguments and methods I can use that are not covered in the examples.. and I do not expect videos/images in the reference section either though they are of course appreciated.
Perhaps the best case is to eventually have much more elaborate examples in the Examples section and little one-off examples in reference to showcase individual functionality.
I think I might have derailed the issue a bit.
Originally, this is about changing font in Text. Which is not (ever?) going to work. That is what PangoText is for.
@naveen521kk, what is the status of PangoText? Is it ready to be used, pending some more testing? If so, we can close this issue.
@cobordism thanks for the input on examples/docstrings, I agree with what you said.
what is the status of PangoText? Is it ready to be used, pending some more testing? If so, we can close this issue.
I think that is done fully. I had also written quite a few tests which check for SVG generated. So I can say it will work.
What do you think is missing so that we can fully use PangoText and get rid of CairoText?
Let's keep this issue open until PangoText becomes the default. Other related discussion can go to their own issues :)
What do you think is missing so that we can fully use PangoText and get rid of CairoText?
I don't really know. First thing, people need to try it and find if there is any bug. Only then, we can make it the default. What I think is we can make it default once we do a first release.
Sounds good to me. It's thoroughly tested already, but let's make the swap after the release.
@naveen521kk have you tried building the docs using PangoText instead of CairoText? That will already cover quite a few more use cases I think. Just one idea for more testing :)
have you tried building the docs using PangoText instead of CairoText? That will already cover quite a few more use cases I think. Just one idea for more testing :)
That's already being built. I did it while I was documenting it. It is here.
I believe this issue has ran its course. We do still have issues with PangoText, but at least now changing fonts is possible in principle. The standing issue is how to make PangoText show a warning if the font is not shown; for that see #757
Most helpful comment
I cannot reproduce this either, looks like you might simply be missing the font.