Comments (15)
Looks like my fault sorry. It needs to be pangocairo
only then it will work.
from manimpango.
You can compile it with
gcc <file-name> $(pkg-config --libs --cflags pango)
.
No luck. Must be some other problem, probably related to gcc/clang on OS X.
Oh!, you are forcing white on it, I see.
Actually, forcing it to whatever the user chose as their preferred color. This is because we do not set the color to the SVGMobject
when MarkupText
is used; that is a difference compared to Text
. With MarkupText
, the color is in the SVG and must not be changed from within Manim anymore.
from manimpango.
This is the error message:
$ gcc -v test.c $(pkg-config --libs --cflags pango) -o test
Undefined symbols for architecture x86_64:
"_cairo_create", referenced from:
_main in test-7a8efa.o
"_cairo_destroy", referenced from:
_main in test-7a8efa.o
"_cairo_move_to", referenced from:
_main in test-7a8efa.o
"_cairo_surface_destroy", referenced from:
_main in test-7a8efa.o
"_cairo_svg_surface_create", referenced from:
_main in test-7a8efa.o
"_pango_cairo_create_layout", referenced from:
_main in test-7a8efa.o
"_pango_cairo_show_layout", referenced from:
_main in test-7a8efa.o
"_pango_cairo_update_layout", referenced from:
_main in test-7a8efa.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I still think it is related to some Xcode / clang / gcc issue on OS X. It might work with Homebrew's gcc and build system.
from manimpango.
While trying out the same with Text
it shows up, the text's are black in colour rather than white.
from manimpango.
I'm not sure I get what you mean, but having white as the default color is expected, see
ManimCommunity/manim#1090
ManimCommunity/manim#1039
from manimpango.
I thought black was the default color? Is there any problems on changing the default text color to black? Or is it a bug in Pango?
from manimpango.
Default color for MarkupText
is WHITE
to avoid text "not showing up" in the video.
from manimpango.
Default color for MarkupText is WHITE to avoid text "not showing up" in the video.
That's fine. I am considering the SVG file here, would there be any problems? Also, I can't reproduce this in C.
#include <cairo.h>
#include <cairo-svg.h>
#include <math.h>
#include <pango/pangocairo.h>
#define WIDTH 600
#define HEIGHT 400
#define TEXT "Hello"
int
main (void)
{
cairo_surface_t* surface;
cairo_t* cr;
PangoFontDescription* font_desc;
PangoLayout* layout;
double width_layout = WIDTH;
double font_size_c= 1;
const char * filename="test.svg";
surface = cairo_svg_surface_create (filename,WIDTH, HEIGHT);
cr = cairo_create (surface);
cairo_move_to(cr,20,20);
layout = pango_cairo_create_layout(cr);
pango_layout_set_width(layout, pango_units_from_double(width_layout));
font_desc = pango_font_description_new();
pango_font_description_set_size(font_desc, pango_units_from_double(font_size_c));
pango_font_description_set_style(font_desc, PANGO_STYLE_ITALIC);
pango_font_description_set_weight(font_desc, PANGO_WEIGHT_BOLD);
pango_layout_set_font_description(layout, font_desc);
pango_font_description_free(font_desc);
cairo_move_to(cr,30,20);
pango_cairo_update_layout(cr,layout);
pango_layout_set_markup(layout, TEXT, -1);
pango_cairo_show_layout(cr, layout);
cairo_destroy (cr);
cairo_surface_destroy (surface);
g_object_unref(layout);
return 0;
}
I think we are doing something wrong and because of that we get white coloured texts.
from manimpango.
I cannot currently compile the above code on my machine due to some linking error / library path issue. But IIRC it will yield black text, no?
I don't know whether we are doing something wrong, but white seems to be a sensible choice for the default color over at Manim. The white color in the SVG created by instantiating a MarkupText
object comes from this code:
from manimpango.
I cannot currently compile the above code on my machine due to some linking error / library path issue.
You can compile it with gcc <file-name> $(pkg-config --libs --cflags pango)
.
But IIRC it will yield black text, no?
Yes, it did, I attach the file, test.svg
The white color in the SVG created by instantiating a MarkupText object comes from this code:
Oh!, you are forcing white on it, I see.
https://github.com/ManimCommunity/manim/blob/71a05e82b954e3046e89100d8116412156495e8d/manim/mobject/svg/text_mobject.py#L1325
Now I understand what is happening. Thanks.
from manimpango.
No luck. Must be some other problem, probably related to gcc/clang on OS X.
If you tell me what are the error I can help, or you can use meson here 😉, I uploaded a zip file with meson configuration
to compile run:
pip install meson ninja
meson builddir --prefix='$PWD/prefix'
meson compile -C builddir
this should create an executable in prefix
which will create an .svg
file.
from manimpango.
I think I got no idea on how to, sorry.
from manimpango.
FWIW, I was able to build it with gcc -o test `pkg-config --cflags --libs pangocairo` test.c
using either the default GCC from OS X Catalina or the one from Homebrew. Usingpkg-config pango
or pkg-config pango cairo
is not sufficient, at least not on my Mac, no matter which gcc I used.
from manimpango.
Oh, this is because of a different shell and isn't about GCC. Essentially, $()
in bash means it will execute the first and then the value gets substituted in the next statement. Maybe, you don't have bash shell?
from manimpango.
No, it's not about the shell. Backticks or $()
are basically the same thing. It's about pango
vs. pangocairo
. They do not yield the same libs and includes:
$ pkg-config --libs-only-l pango
-lpango-1.0 -lgobject-2.0 -lglib-2.0 -lintl -lharfbuzz
vs.
pkg-config --libs-only-l pango cairo
-lpango-1.0 -lgobject-2.0 -lglib-2.0 -lintl -lharfbuzz -lcairo
vs.
$ pkg-config --libs-only-l pangocairo
-lpangocairo-1.0 -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lintl -lharfbuzz -lcairo
The missing symbols were namely
"_pango_cairo_create_layout", referenced from:
_main in test-c1d4ee.o
"_pango_cairo_show_layout", referenced from:
_main in test-c1d4ee.o
"_pango_cairo_update_layout", referenced from:
_main in test-c1d4ee.o
which must have been due to the missing -lpangocairo-1.0
.
from manimpango.
Related Issues (20)
- list index out of range when rebasing HOT 2
- Failed to install via pip in GitHub Action HOT 6
- Add option to Register Fonts using Fc backend on Windows and macOS
- Showing Errors in Markup if any HOT 2
- Remove linux wheels totally HOT 1
- libpango-1.0.so.0: undefined symbol: hb_buffer_set_invisible_glyph HOT 2
- CI: Windows-2016 environment will be removed soon HOT 1
- macOS: Wheels in v0.4.0 isn't working
- Symbol not found: ___darwin_check_fd_set_overflow HOT 8
- M1 Mac Installation Problem HOT 2
- Error when installing ManimPango via pip on windows HOT 13
- Implemented a refactored version HOT 4
- Cannot show Text in Ubuntu20.04 HOT 7
- Building/dependencies HOT 1
- symbol not found in flat namespace HOT 5
- Failed building wheel for manimpango HOT 16
- Installing issue with AUR/YaY and PIP HOT 1
- Problem with MANIM installation. HOT 6
- `register_font` broken on Windows with Pango 1.50.12 + Cairo 1.17.6 HOT 1
- Tests fail to run from PyTest: ManimPango could not import and load the necessary shared libraries. HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from manimpango.