summaryrefslogtreecommitdiff
path: root/pango/pango-attributes.c
Commit message (Collapse)AuthorAgeFilesLines
* Improve PangoAttrList serializationMatthias Clasen2022-11-181-9/+61
| | | | | | | Document the format, and improve the parser a bit, so we can use this format in GtkBuilder. Update affected tests.
* AVoid a use-after-free in pango_attr_list_changeMatthias Clasen2022-03-181-0/+3
| | | | | | | | | This was showing up as crashes in pitivi and inkscape. The added test does not crash, but it does produce the wrong result without the fix. Fixes: #678
* Maintain order in pango_attr_list_changeMatthias Clasen2022-03-181-0/+3
| | | | | | | When PangoAttrList was changed to use an array, we lost the code that maintained non-decreasing order in pango_attr_list_change. Bring it back, and add a test for this.
* Fix a g_ascii_formatd callfix-asciid-callMatthias Clasen2022-01-181-1/+1
| | | | | | | | | | | We were passing a format specifier that starts with ' ', which some implementations of that API don't like. This change removes an extraneous space from the output. Update affected tests. Fixes: #659
* Reinstate previous behavior or pango_attr_list_spliceattrlist-spliceMatthias Clasen2022-01-071-3/+17
| | | | | | | | | | If gap is zero, don't limit the inserted attributes; that does not make sense. Spell out the different use cases in the docs. Testcase included. Fixes: #653
* Clarify pango_attr_list_splice docsMatthias Clasen2022-01-071-1/+1
| | | | | Make it explicit that the spliced-in attributes are limited to the the 'gap'.
* doc: fixesMatthias Clasen2021-12-021-1/+1
|
* Tweak word and sentence attributesMatthias Clasen2021-11-191-2/+2
| | | | | | The value does not really matter for these, but it looks more natural if they have a value of 1, and not 0.
* Add layout serialization apiMatthias Clasen2021-11-181-3/+2
| | | | | | | | Add api to serialize PangoLayout, for the benefit of testing and debugging. Currently, this uses json, but that is an implementation detail. Some tests included.
* Add pango_attr_list_to/from_stringMatthias Clasen2021-11-171-0/+543
| | | | | | Add an api to serialize PangoAttrList. This will be useful in testing and debugging.
* add missing since 1.50 annotationsBilal Elmoussaoui2021-10-291-0/+2
|
* Add docs for new attributesMatthias Clasen2021-09-011-0/+27
|
* Implement font-dependent scalingMatthias Clasen2021-08-311-5/+26
| | | | | | | Add a new font-scale attribute to indicate font size changes due to super- and subscript shifts, and handle it during item post-processing to find the right font sizes.
* Implement baseline shiftsMatthias Clasen2021-08-311-0/+25
| | | | | | | | | | | Add a new baseline-shift attribute, which is similar to rise, but accumulates. In addition, it supports font- relative values such as superscript and subscript. We implement support for this by computing baseline shifts for run during line post-processing, and storing them in the runs. The renderer now takes these shifts into account when rendering layout lines.
* Add segmentation attributesbreak-tailoringMatthias Clasen2021-08-251-0/+56
| | | | | | | Add attributes that let us override word and sentence boundaries (and, indirectly, line breaks). Tests included.
* attributes: Silence compiler warningsMatthias Clasen2021-08-221-9/+9
|
* Add a forgotten binding helperMatthias Clasen2021-08-221-0/+1
| | | | The new text-transform attribute was overlooked.
* Fix binding helpers for absolute-line-heightMatthias Clasen2021-08-221-0/+1
| | | | This was overlooked.
* markup: Add a text transform attributeMatthias Clasen2021-08-201-0/+26
| | | | | | Add a PangoTextTransform enum, a PangoAttribute to set it on runs of text, and support for parsing it out of markup.
* Some code reorgcode-reorgMatthias Clasen2021-08-201-506/+531
| | | | Reshuffle pango-attributes.c internally.
* Some code reorgMatthias Clasen2021-08-201-0/+22
| | | | | Split the itemization code into its own file, and move things around a bit.
* Add line-height attributesMatthias Clasen2021-08-081-0/+53
| | | | | | | | | | | | Add attributes for line-height, in a relative and absolute variant. This will be used to grow the logical extents of runs in a way that is compatible with CSS semantics. In markup, we support a new line_height attribute that will be interpreted as absolute if it is an integer > 1024, and as a relative factor otherwise.
* attributes: Add helper api for introspectionintrospection-fixesMatthias Clasen2021-08-011-0/+254
| | | | | | | | Add functions to cast PangoAttribute to the various struct types, so language bindings can get at the payload. Fixes: #476
* Correctly handle font attributesbetter-ellipsizeMatthias Clasen2021-07-221-9/+10
| | | | | | | | | | pango_attr_iterator_get_attributes only returns the innermost attribute of each kind. That is correct for attributes that supersede each other, but not for font descriptions, which get merged. So, keep all font attributes in the returned list. Update affected tests.
* font-desc: Use local volatile double values to store sizesMarco Trevisan (Treviño)2021-07-211-2/+8
| | | | | | | | | | | | | | | | | | | | Under i386 multiplying double and integer values and cast it to integer may end up to compute the wrong value when only 387 FPU is used, because the temporary value will be stored in a register whose precision isn't good enough. And so, some multiplications which are expected to produce an integer, will actually return a truncated value, that will be eventually floored. An example is 1.2 * 12800 that is clearly 15360.0, but will produce 15359 when casted to int in the said i386 environment. So use a temporary double variable to ensure that we do this computation in the double scope, before casting to int. And this will avoid using the said register, even when using more aggressive optimizations (as per marking the local variable volatile). Fixes: https://gitlab.gnome.org/GNOME/pango/-/issues/580
* Remove an erroneous early exitMatthias Clasen2021-07-091-9/+6
| | | | | | | | pango_attr_list_change was returning early in one case, missing to do some necessary cleanup of the list. Fixes: #564
* Link to the CSS font-feature-settings docs for pango_attr_font_features_newFederico Mena Quintero2021-06-141-1/+5
| | | | Fixes https://gitlab.gnome.org/GNOME/pango/-/issues/565
* docs: Link syntax fixesdocs-link-fixesMatthias Clasen2021-05-251-3/+3
| | | | | Now that gi-docgen warns about link syntax errors, we can find and fix them.
* Explicitly preserve unlimited attributesMatthias Clasen2021-05-231-18/+24
| | | | | When calling pango_attr_list_update(), we must not change the limits or attributes that are unlimited.
* Merge branch 'doc-fixes' into 'master'Matthias Clasen2021-05-231-1/+1
|\ | | | | | | | | docs: Fix link syntax in a few places See merge request GNOME/pango!337
| * docs: Fix link syntax in a few placesdoc-fixesMatthias Clasen2021-05-231-1/+1
| |
* | Avoid unsigned int pitfallsMatthias Clasen2021-05-231-1/+2
|/ | | | | | | | | When we tried to catch attr list overflow in 895759096309e7c, we overlooked that add - remove can be negative, leading to unexpected results. Avoid this case. Fixes: #561
* docs: Convert gtk-doc syntax leftoversdocs-cleanupMatthias Clasen2021-05-191-178/+240
| | | | | Remove leftovers like #Type, reduce indentations to avoid markdown block quotes, etc.
* introspection: Stop using allow-noneMatthias Clasen2021-05-191-4/+4
| | | | | The allow-none annotation has been deprecated for a long time already. Instead use optional and nullable everywhere.
* Fix various broken linksMatthias Clasen2021-03-111-2/+2
| | | | All these were pointed out by gi-docgen warnings.
* docs: Tweak attributes docsMatthias Clasen2021-03-111-20/+32
| | | | Give doc comments summaries, etc.
* docs: Port PangoAttribute to the new doc formatMatthias Clasen2021-03-111-400/+396
| | | | Replace gtk-doc'isms and use gi-docgen links instead.
* docs: Convert markup and attributes docs to pango_markup.mdMatthias Clasen2021-03-111-11/+0
|
* docs: Replace lots of vestigial xml markupMatthias Clasen2021-03-111-1/+1
| | | | | We want to use pure markdown, since docbook is going away as the intermediate format.
* Fix a corner-case of pango_attr_list_splicefix-attribute-splicingMatthias Clasen2021-02-171-2/+5
| | | | | | | | | | | | | | When the 'other' list contains attributes that are unlimited or exceed the range given to pango_attr_list_splice, those attributes were 'leaking' out of the range. The visible effect of this is that the underline of preedit text extends outside the preedit in some GTK entries. Fix this by clipping the inserted attributes to the range. The documentation is not very explicit about this, but I believe this is the expected behavior. Tests included.
* Avoid overflow when updating attr listsattr-list-overflowMatthias Clasen2021-01-231-1/+4
| | | | | | | | | | | Avoid overflow when updating the end_index of attributes in pango_attr_list_update. This is a real risk, because end_index is commonly set to G_MAXUINT to mean 'until the very end'. Test included. Fixes: #455
* Add some preconditionsMatthias Clasen2021-01-231-0/+4
| | | | | The arguments to pango_attr_list_update are ints, but negative numbers don't make sense here.
* Fix attr iterators with overlapping attributesfix-nested-attributesMatthias Clasen2020-09-171-11/+6
| | | | | | | | | | | | | This broke when PangoAttrIterator was changed to use an array for the stack of current attributes, in dec6c0868ef2c36. We were not always walking the array in the right order. The first attribute to check is at the *end* of the array. This showed up as misrendering in epsilon_0 example in gtk3-demo's text view markup demo. Test included.
* Adjust "Since" tags to refer to 1.46Rico Tzschichholz2020-08-061-2/+2
|
* pango-attributes.c: Fix on older compilersChun-wei Fan2020-06-241-2/+4
| | | | | Avoid declaring a variables in a for loop initialization, so that we won't accidentally break building on older compilers.
* Fix crashes with empty attribute listsMatthias Clasen2020-06-221-52/+54
| | | | | | | | There were a few cases left where empty attribute lists could lead to crashes. This was observed causing crashes in gnumeric. Testcases included.
* Fix another problem with pango_attr_list_changeMatthias Clasen2020-06-171-7/+11
| | | | | This was showing up as the colored Google link in the gtk4-demo links demo losing its colors.
* Fix a crash in pango_attr_list_equalMatthias Clasen2020-06-101-0/+3
| | | | | When allowing attributes to be NULL, we need to take that into account here too.
* Fix pango_attr_list_changeMatthias Clasen2020-06-101-3/+9
| | | | | | There were some breakage introduced in the porting to GPtrArray - we sometimes ran into assertions, and sometimes forgot to add the new attribute altogether.
* attrs: Save attribute list in a GPtrArrayTimm Bäder2020-06-101-301/+225
|