[cairo] ODP: cairo-ft.h
Rafał Jopek
rafaljopek at hotmail.com
Sun Nov 13 10:29:05 UTC 2022
For my part, it is:
```
$ pkg-config --cflags cairo freetype2
-I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/uuid -I/usr/include/freetype2 -I/usr/include/libpng16
```
I installed all the dependencies, maybe missed something, sorry in advan:
```
C:/msys64/mingw64/include/cairo/cairo-ft.h:46:10: fatal error: ft2build.h: No such file or directory
46 | #include <ft2build.h>
| ^~~~~~~~~~~~
```
Kind regards,
-- Rafał
________________________________
Od: suzuki toshiya <mpsuzuki at hiroshima-u.ac.jp>
Wysłane: sobota, 12 listopada 2022 13:05
Do: Rafał Jopek <rafaljopek at hotmail.com>; cairo at cairographics.org <cairo at cairographics.org>
Temat: Re: [cairo] cairo-ft.h
What `pkg-config --cflags freetype2 cairo` would return in your environment?
In my case, it returns like below.
$ pkg-config --cflags freetype2 cairo
-I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/uuid -I/usr/include/freetype2 -I/usr/include/libpng16
The code you pasted,
> #include <cairo/cairo.h>
> #include <cairo/cairo-ft.h>
> //#include <cairo.h>
> //#include <cairo-ft.h>
>
> #include <freetype2/ft2build.h>
> //#include <ft2build.h>
looks like the situation that CFLAGS was not set properly, and cannot find cairo.h or ft2build.h, and you might have tried to fix by a workaround in C source (and failed). Please check your `pkg-config --cflags freetype2 cairo` you wrote in Makefile
Regards,
mpsuzuki
On 2022/11/12 18:35, Rafał Jopek wrote:
> Hi,
>
> Maybe someone is trying to make a compilation of this simple codes
> For me, it signals an error even though I have all the dependencies installed, we are talking about MSYS2
>
> ```
> C:/msys64/mingw64/include/cairo/cairo-ft.h:46:10: fatal error: ft2build.h: No such file or directory
> 46 | #include <ft2build.h>
> | ^~~~~~~~~~~~
> ```
>
> free-type.c
>
> ```
>
> // free-type.c
> #include <stdio.h>
> #include <stdlib.h>
> #include <cairo/cairo.h>
> #include <cairo/cairo-ft.h>
> //#include <cairo.h>
> //#include <cairo-ft.h>
>
> #include <freetype2/ft2build.h>
> //#include <ft2build.h>
>
> #include FT_SFNT_NAMES_H
> #include FT_FREETYPE_H
> #include FT_GLYPH_H
> #include FT_OUTLINE_H
> #include FT_BBOX_H
> #include FT_TYPE1_TABLES_H
>
> int main()
> {
> FT_Library value;
> FT_Error status;
> FT_Face face;
>
> cairo_t *c;
> cairo_surface_t *cs;
> cairo_font_face_t * ct;
> int size = 200;
>
> cs = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, size, size);
> c = cairo_create (cs);
>
> const char * filename = "/usr/local/share/fonts/Droid/DroidSansFallbackFull.ttf";
>
> status = FT_Init_FreeType (& value);
> if (status != 0) {
> fprintf (stderr, "Error %d opening library.\n", status);
> exit (EXIT_FAILURE);
> }
> status = FT_New_Face (value, filename, 0, & face);
> if (status != 0) {
> fprintf (stderr, "Error %d opening %s.\n", status, filename);
> exit (EXIT_FAILURE);
> }
> ct = cairo_ft_font_face_create_for_ft_face (face, 0);
> cairo_set_font_face (c, ct);
> cairo_set_font_size (c, size/3);
> cairo_set_source_rgb (c, 0, 0, 0);
> cairo_move_to (c, size/6, size/3);
> cairo_show_text (c, "あい");
> cairo_set_source_rgb (c, 0.5, 0.5, 0);
> cairo_move_to (c, size/6, 5*size/6);
> cairo_show_text (c, "金柑");
> cairo_surface_write_to_png (cs, "free-type.png");
> return 0;
> }
>
>
> ```
>
> Makefile
>
> ```
>
> C=free-type.c
> CFLAGS = -Wall -g `pkg-config --cflags freetype2 cairo`
> LDFLAGS = `pkg-config --libs freetype2 cairo`
>
> all: free-type.png
>
> free-type.png: free-type
> ./free-type
>
> free-type: $(C)
> $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(C)
>
> clean:
> -rm -f free-type free-type.png
>
>
> ```
>
>
> Kind regards,
> -- Rafał
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.cairographics.org/archives/cairo/attachments/20221113/c0b047f7/attachment.htm>
More information about the cairo
mailing list