# Cairo text functions discrepancies

**URL:** <https://discourse.julialang.org/t/cairo-text-functions-discrepancies/105635>\
**Category:** General Usage\
**Tags:** package, plotting, fonts, cairo\
**Created:** [October 31, 2023, 10:56pm UTC](https://discourse.julialang.org/t/cairo-text-functions-discrepancies/105635 "2023-10-31T22:56:47Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![RaulDurand](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rauldurand/32/2044_2.png) [@RaulDurand](https://discourse.julialang.org/u/RaulDurand)\
**Post date:** [October 31, 2023, 10:56pm UTC](https://discourse.julialang.org/t/cairo-text-functions-discrepancies/105635/1 "2023-10-31T22:56:47Z")

</div>

I am testing the different text drawing functions in Cairo.jl: `show_text`, `text`, and `text_path`. The `text` function is the only one that produces the wrong size and is positioned at a distance from the insertion point (see below).

Is this a Cairo bug or a feature?

The Cairo manual says that toy functions are not meant for serious work, but they seem to exhibit the expected behavior. I also noticed that Makie uses the toy functions instead of `text`.

![image](https://global.discourse-cdn.com/julialang/original/3X/3/d/3dde63ebdc721a83c3d27945b92add4edd6ca1ef.png)

---

<div class="post-metadata">

**Author:** ![cormullion](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cormullion/32/49131_2.png) [@cormullion](https://discourse.julialang.org/u/cormullion)\
**Post date:** [November 1, 2023, 3:50pm UTC](https://discourse.julialang.org/t/cairo-text-functions-discrepancies/105635/2 "2023-11-01T15:50:25Z")

</div>

> [@RaulDurand](#):
>
> Is this a Cairo bug or a feature?

This is more likely something to do with Pango, because `Cairo.text()` passes all text layout tasks to `pango_layout_set_text ()`. I expect a [Pango layout](https://docs.gtk.org/Pango/class.Layout.html) will look slightly different to a single line of text drawn with the Toy text API.

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://discourse.julialang.org/u/jules)\
**Post date:** [November 1, 2023, 6:22pm UTC](https://discourse.julialang.org/t/cairo-text-functions-discrepancies/105635/3 "2023-11-01T18:22:54Z")

</div>

In Makie we compute the glyph layout separately, then it doesn’t really matter if I use the pro or toy API to draw the glyphs one by one.
