Skip to content
This repository has been archived by the owner on Jun 8, 2021. It is now read-only.

need an enum for the PangoScale values #193

Closed
emmanueltouzery opened this issue Aug 5, 2020 · 6 comments
Closed

need an enum for the PangoScale values #193

emmanueltouzery opened this issue Aug 5, 2020 · 6 comments

Comments

@emmanueltouzery
Copy link
Contributor

the original values are there:
https://developer.gnome.org/pango/stable/pango-Text-Attributes.html#PANGO-SCALE-X-LARGE:CAPS

They are #defined in pango. I believe they're needed to build a GtkTextTag with a specific size, as in the gtk3 demo:

  gtk_text_buffer_create_tag (buffer, "big",
                              /* points times the PANGO_SCALE factor */
                              "size", 20 * PANGO_SCALE, NULL);

  gtk_text_buffer_create_tag (buffer, "xx-small",
                              "scale", PANGO_SCALE_XX_SMALL, NULL);

  gtk_text_buffer_create_tag (buffer, "x-large",
                              "scale", PANGO_SCALE_X_LARGE, NULL);

I'm not really sure it should be an enum though, because the first example there seems to do arithmetic with the value (20*PANGO_SCALE).

@sdroege
Copy link
Member

sdroege commented Aug 5, 2020

They should be constants in the bindings, or maybe we need a Scale type that also implements arithmetic operations but that would be a second step.

@EPashkin
Copy link
Member

EPashkin commented Aug 5, 2020

There no PANGO_SCALE_ in Pango-1.0.gir so it need be added manually

@emmanueltouzery
Copy link
Contributor Author

i'm sorry i think the arithmetic is probably not needed. The first case that does arithmetic populates the "size". When "scale" is populated the values are directly put in. I think PANGO_SCALE is something else than PANGO_SCALE_*

@sdroege
Copy link
Member

sdroege commented Aug 5, 2020

PANGO_SCALE is a scaling constant, IIRC it's the value "1.0" for the fixed point pango scale. The PANGO_SCALE_XXX constants are constants for specific values

@sdroege
Copy link
Member

sdroege commented Aug 6, 2020

@emmanueltouzery Do you want to create a PR for adding such constants?

@emmanueltouzery
Copy link
Contributor Author

Ok, I'll try to prepare a PR ASAP (might take me a little time)

GuillaumeGomez added a commit that referenced this issue Aug 9, 2020
fixes #193 add constants for PANGO_SCALE_*
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants