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

RFC: Better Text Rendering for cairo / lua #1501

Open
wants to merge 29 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
2a0db1d
lua text: Supporting infra
simotek Jan 14, 2023
79b81a6
lua text: initial implementation.
simotek Feb 14, 2023
24706e8
Add the ability to center and right align text.
simotek Apr 11, 2023
d5d20e8
lua text: Remove test code
simotek Apr 12, 2023
b625e93
lua text: Supporting infra
simotek Jan 14, 2023
4077ad5
lua text: initial implementation.
simotek Feb 14, 2023
00b2ec0
Commit the WIP so I can merge it
simotek Feb 12, 2024
5036cc4
Fix for #1698
simotek Feb 14, 2024
488b450
Fix comment hb-unicode.h should be hb-common.h
simotek Feb 14, 2024
b0063e5
Swap to using optional parameters
simotek Feb 14, 2024
945ce1f
Add Hack for RTL positioning
simotek Feb 15, 2024
dc7c0e0
Remove Top to Bottom Fixme's they are fixed
simotek Feb 15, 2024
ca1be94
Merge branch 'lua-text-helper2' into lua-text-helper3
simotek Feb 15, 2024
47c45af
Some general cleanup post merge
simotek Feb 15, 2024
7553faf
Attempt to fix workflows by adding freetype dep
simotek Feb 15, 2024
2c74058
Probably actually need freetype6
simotek Feb 15, 2024
7e2a662
Try again, I don't understand Ubuntu
simotek Feb 15, 2024
ac50fa7
Try something from google
simotek Feb 15, 2024
ba71b73
lua-text: Move to caching fonts in C
simotek Feb 21, 2024
8f34c9d
Revert "Fix for #1698"
simotek Feb 22, 2024
9ba643c
docs: tolua++ now works with more then lua5.1
simotek Feb 22, 2024
f4f7462
lua-text: Add docs.
simotek Feb 22, 2024
e5482ca
lua-text: Fix build with
simotek Mar 5, 2024
f9676c6
Merge branch 'main' into lua-text-helper3
simotek Oct 17, 2024
78b222f
lua-text use cairo_fill_preserve
simotek Oct 29, 2024
9fc5fa9
Doc: Implement feedback from #1501 for tables
simotek Nov 18, 2024
755c700
Merge branch 'main' into lua-text-helper3
simotek Nov 18, 2024
872d87b
lua-text: Another shot at fixing workflows
simotek Nov 18, 2024
b1bd605
cmake: try and use find_package for freetype
simotek Nov 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions doc/lua.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -184,3 +184,44 @@ values:
- name: RsvgDimensionData:get()
desc: |-
Gets the values of an existing RsvgDimensionData.
- name: cairo_text_hp_show(cr, x, y, text, font, font_size, alignment, language, script, direction)
desc: |-
Renders text to a cairo_t using harfbuzz and freetype, this provides significantly
better text rendering then using cairo's inbuilt functions.

| Argument | Description |
|---------------------|--------------------------------------------------------------------------------------|
| cr | The `cairo_t` to render to. |
| x,y | Position to render the text. |
| text | The text to render. |
| font | The name of the font to be used, `Fontconfig` is used to search for the font. |
| font_size | The font size. |
| alignment | One of `CAIRO_TEXT_ALIGN_LEFT`, `CAIRO_TEXT_ALIGN_RIGHT`, `CAIRO_TEXT_ALIGN_CENTER`. |
| | Default value: `CAIRO_TEXT_ALIGN_LEFT` |
| language | A string containing a BCP 47 language tag. |
| | Default value: `en` |
| script | A string containing a ISO 15924 script tag. |
| | Default value: auto-detect from text |
| direction | A string representing text direction eg `LTR`, `RTL` or `TTB` |
| | Default value: auto-detect from text otherwise `LTR` | |
simotek marked this conversation as resolved.
Show resolved Hide resolved
- name: width,height:cairo_text_hp_text_size(text, font, font_size, language, script, direction)
desc: |-
Used to calculate how many pixels will be required to render a string with
`cairo_text_hp_show` returns a pair of int's with `width` and `height`.

| Argument | Description |
|---------------------|--------------------------------------------------------------------------------------|
| cr | The `cairo_t` to render to. |
| text | The text to render. |
| font | The name of the font to be used, `Fontconfig` is used to search for the font. |
| font_size | The font size. |
| language | A string containing a BCP 47 language tag. |
| | Default value: `en` |
| script | A string containing a ISO 15924 script tag. |
| | Default value: auto-detect from text |
| direction | A string representing text direction eg `LTR`, `RTL` or `TTB` |
| | Default value: auto-detect from text otherwise `LTR` |
simotek marked this conversation as resolved.
Show resolved Hide resolved
- name: cairo_text_hp_delete_fonts()
desc: |-
`cairo_text_hp_show` and `cairo_text_hp_text_size` both cache internal font details,
this function clears those caches.
Loading