summaryrefslogtreecommitdiff
path: root/pango/pango-markup.c
Commit message (Collapse)AuthorAgeFilesLines
* font-desc: Use local volatile double values to store sizesMarco Trevisan (Treviño)2021-07-211-6/+10
| | | | | | | | | | | | | | | | | | | | 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
* markup: Don't accept attributes on <markup>Matthias Clasen2021-06-281-0/+1
| | | | Better to enforce this.
* markup: Separate out all casesMatthias Clasen2021-06-281-1/+6
| | | | | | No point in having a few attributes handled in the default case. Just split them all by the first char.
* markup: Save a few linesMatthias Clasen2021-06-281-20/+4
| | | | pango_markup_parser_new_internal can't really fail.
* docs: Reduce redundancydocs-cleanupsMatthias Clasen2021-05-201-8/+8
| | | | | | Remove a boatload of "or %NULL" from nullable parameters and return values. gi-docgen generates suitable text from the annotation that we don't need to duplicate.
* introspection: Stop using allow-noneMatthias Clasen2021-05-191-6/+6
| | | | | The allow-none annotation has been deprecated for a long time already. Instead use optional and nullable everywhere.
* docs: Tweak markup docsMatthias Clasen2021-03-111-18/+25
| | | | Add summaries, convert markup, etc.
* docs: Convert markup and attributes docs to pango_markup.mdMatthias Clasen2021-03-111-191/+0
|
* docs: Replace lots of vestigial xml markupMatthias Clasen2021-03-111-7/+5
| | | | | We want to use pure markdown, since docbook is going away as the intermediate format.
* markup: Fix two bugsMatthias Clasen2021-03-021-30/+20
| | | | | | | | | | The docs state that all chars marked with the accel marker get an underline. But we were only underlining the first in each text chunk. Second, if an underline appears at the end of a text chunk, or at the end of the text, we would just eat it, which is unexpected.
* Export pango_parse_color_with_alphaMatthias Clasen2020-07-311-1/+1
| | | | | This will be useful to make GdkRGBA support hex formats with alpha.
* pango-color: Tweak semantics of _pango_parse_color_with_alphaMatthias Clasen2020-07-311-2/+2
| | | | | | | Make it return 0xffff if alpha is not present (this will be more convenient when we use this function in GdkRGBA). Update all users.
* Docs: improve formatting of markup descriptionJohn Beard2020-05-111-99/+103
| | | | | | | | | * Place <span> attributes and convenience tags into lists to avoid a text wall. * Add headings for each list * Fix broken colour specifications (e.g. #FF0000 had lost the '#') * Fix broken |piped| monospace sections * `backticks` rather than 'quotes'
* Document new underline valuesMatthias Clasen2019-10-311-1/+2
|
* Add an overline attributeMatthias Clasen2019-10-311-0/+33
| | | | | | | | | | Add a new PangoOverline enum, and overline and overline_color attributes, which parallel the attributes we have for underlines and strikethrough. For now, the enum just has 'none' and 'single' values.
* Add an insert-hyphens attributeMatthias Clasen2019-08-041-0/+18
| | | | | | | | | Add a text attribute that allows to suppress insertion of hyphens at intra-word line breaks. This is useful for non-paragraph-like contexts, where line breaks are needed, but hyphens are not expected.
* markup: Support the new attributeMatthias Clasen2019-07-251-0/+43
| | | | Add markup support for show="space|ignorables".
* Add an allow-breaks attributeMatthias Clasen2019-07-201-0/+17
| | | | | Add a new attribute type, and parse allow_breaks="false" in markup. This is useful to prevent hyphenation of words.
* Documentation tweaksMatthias Clasen2019-07-131-0/+165
|
* Avoid a critical from markup parsingMatthias Clasen2019-07-051-0/+13
| | | | | | gravity='auto' is not a valid value here. Closes: https://gitlab.gnome.org/GNOME/pango/issues/203
* Add prototype for _pango_color_parse_with_alpha()Emmanuele Bassi2017-05-191-5/+0
| | | | | | | | It's used in pango-markup.c and pango-color.c, so it should have an internally-available prototype, instead of an `extern` declaration at the point of use. This also avoids a compiler warning for a missing prototype.
* Avoid deprecation warningsMatthias Clasen2016-08-291-4/+5
| | | | | Now that we're using new-style deprecations, we have to fight a little harder to get rid of them inside pango.
* Allow rgba colors in markupMatthias Clasen2015-08-141-5/+17
| | | | | | | For foreground and background colors, allow #rrggbbaa to specify a color with alpha. This will be returned as two attributes, for color and alpha. underline_color and strikethrough_color are still limited to #rrggbb, with no alpha component.
* Support alpha in markupwip/matthiasc/alphaMatthias Clasen2015-08-111-3/+85
| | | | | | Support alpha and background_alpha attributes on span elements. The value can either be a plain integer between 1 and 65536 or a percentage like 50%.
* Bug 738505 - Add fontfeatures support in PangoAttributes and markupBehdad Esfahbod2015-06-181-2/+10
| | | | | | | | | | | https://bugzilla.gnome.org/show_bug.cgi?id=738505 Patch from Matthias Clasen, based on early patch from Akira TAGOH. There's room for improvement in how this is done, but it works now for simple cases, which is what most people will be using it for. Finally!
* Bug 707131 - removing useless test.Jehan2013-09-041-1/+1
| | | | | | | | | Since pango_scan_int() would return FALSE if the scanned value was over INT_MAX; and the reference out value's type is an int, (n > INT_MAX) test is unecessary. If pango_scan_int() behavior was to be changed to accept long int, an explicit test should be added (or the PangoAttrSize type updated to handle long int too).
* Bug 707131 - getting rid of the arbitrary MAX_SIZE for font.Jehan2013-08-311-7/+4
| | | | | Since the value is stored as an int, no reason to use any other value than INT_MAX.
* markup: Remove error from markup parser constructorJasper St. Pierre2012-12-141-7/+9
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=679299
* markup: Allow incrementally parsing pango markupJasper St. Pierre2012-12-141-64/+166
| | | | | | | This is intended for applications that need to parse pango markup from some sort of GIO stream. https://bugzilla.gnome.org/show_bug.cgi?id=679299
* markup: Always start with a <markup> tagJasper St. Pierre2012-12-141-16/+10
| | | | | | | It doesn't do anything bad, and will help us when we move to a stream-based approach. https://bugzilla.gnome.org/show_bug.cgi?id=679299
* [GI] Add (allow-none) annotations to pango_parse_markup().Laszlo Pandy2011-02-091-3/+3
|
* [GI] Annotate out arguments of pango_parse_markup().Laszlo Pandy2011-02-041-3/+3
|
* Bug 469049 – Fix all compiler warningsBehdad Esfahbod2008-12-261-3/+3
| | | | | | | | | | | | | | | | | | | | | 2008-12-25 Behdad Esfahbod <behdad@gnome.org> Bug 469049 – Fix all compiler warnings * pango-view/viewer-pangocairo.c (render_callback): * pango/fonts.c (append_field), (pango_font_description_to_string): * pango/opentype/harfbuzz-dump.c: * pango/pango-bidi-type.c (pango_log2vis_get_embedding_levels): * pango/pango-coverage.c (pango_coverage_set): * pango/pango-markup.c (span_parse_func): * pango/pango-renderer.c (pango_renderer_default_draw_error_underline): * pango/pango-utils.c (pango_scan_string): * pango/pangocairo-render.c (pango_cairo_renderer_draw_trapezoid), (draw_error_underline), (pango_cairo_renderer_class_init): Fix all the remaining warnings. svn path=/trunk/; revision=2767
* Fix warnings.Behdad Esfahbod2008-12-261-33/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2008-12-25 Behdad Esfahbod <behdad@gnome.org> * pango/break.c (pango_default_break): * pango/fonts.c (find_field_any), (pango_font_class_init), (pango_font_init), (pango_font_metrics_ref), (pango_font_metrics_unref), (pango_font_family_class_init), (pango_font_family_init), (pango_font_face_class_init), (pango_font_face_init): * pango/pango-attributes.c (pango_attr_list_ref), (pango_attr_list_unref), (pango_attr_iterator_get_font): * pango/pango-layout.c (pango_layout_set_height), (extents_free), (no_shape_filter_func), (pango_layout_line_ref), (pango_layout_line_unref), (pango_layout_get_item_properties): * pango/pango-markup.c (end_element_handler), (text_handler), (b_parse_func), (big_parse_func), (span_parse_func), (i_parse_func), (markup_parse_func), (s_parse_func), (sub_parse_func), (sup_parse_func), (small_parse_func), (tt_parse_func), (u_parse_func): * pango/pango-ot-info.c (get_glyph_class): * pango/pango-renderer.c (get_item_properties), (pango_renderer_default_prepare_run): * pango/pango-utils.c (_pango_shape_shape): * pango/pangocairo-fcfontmap.c (pango_cairo_fc_font_map_get_font_type), (pango_cairo_fc_font_map_context_substitute), (pango_cairo_fc_font_map_context_key_get), (pango_cairo_fc_font_map_context_key_copy), (pango_cairo_fc_font_map_context_key_free), (pango_cairo_fc_font_map_context_key_hash), (pango_cairo_fc_font_map_context_key_equal): * pango/pangocairo-fontmap.c (pango_cairo_font_map_new_for_font_type), (pango_cairo_font_map_set_default): * pango/pangocairo-render.c (pango_cairo_renderer_init): * pango/pangox-fontcache.c (free_cache_entry): * pango/pangox-fontmap.c (close_display_cb), (list_families_foreach), (pango_x_font_map_load_font), (ignore_error): * pango/pangox.c (average_width_foreach), (subfonts_foreach), (pango_x_font_find_shaper), (pango_x_get_unknown_glyph), (pango_x_get_item_properties), (pango_x_apply_ligatures), (pango_x_font_get_unknown_glyph): * pango/pangoxft-fontmap.c (pango_xft_font_map_init), (close_display_cb): * pango/querymodules.c (show_version): Fix warnings. svn path=/trunk/; revision=2765
* Include "config.h" instead of <config.h> Command used: find -nameJohan Dahlin2008-06-221-1/+1
| | | | | | | | | | | | 2008-06-21 Johan Dahlin <jdahlin@async.com.br> * *.[ch]: Include "config.h" instead of <config.h> Command used: find -name \*.[ch]|xargs perl -p -i -e 's/^#include <config.h>/#include "config.h"/g' Rubberstamped by Behdad svn path=/trunk/; revision=2657
* Bug 490669 – add some <span> attribute aliasesBehdad Esfahbod2008-04-211-1/+11
| | | | | | | | | | | | | 2008-04-21 Behdad Esfahbod <behdad@gnome.org> Bug 490669 – add some <span> attribute aliases * docs/pango_markup.sgml: * pango/pango-markup.c (span_parse_func): Add fgcolor, bgcolor, font, font_size, font_weight, font_variant, ... svn path=/trunk/; revision=2603
* Bug 399573 – replace strtoul in pango-markup.c with pango_scan_int()Behdad Esfahbod2007-12-101-8/+9
| | | | | | | | | | | | 2007-12-10 Behdad Esfahbod <behdad@gnome.org> Bug 399573 – replace strtoul in pango-markup.c with pango_scan_int() * pango/pango-markup.c (span_parse_func): Use pango_scan_int() and improve error message on parse failure. svn path=/trunk/; revision=2520
* Bug 481537 – compiler warning fixes Patch from Kjartan MaraasBehdad Esfahbod2007-10-151-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | 2007-10-15 Behdad Esfahbod <behdad@gnome.org> Bug 481537 – compiler warning fixes Patch from Kjartan Maraas * pango/break.c (pango_get_log_attrs): * pango/pango-attributes.c (pango_attr_list_insert_internal): * pango/pango-layout.c (process_item), (justify_clusters): * pango/pango-markup.c (span_parse_boolean): * pango/pango-ot-ruleset.c (pango_ot_ruleset_finalize), (pango_ot_ruleset_new): * pango/pango-utils.c (pango_scan_int): * pango/pangocairo-font.c (_pango_cairo_font_install): * pango/pangofc-font.c (pango_fc_font_create_metrics_for_context): * pango/pangoft2.c (load_fallback_face): * pango/pangox-fontmap.c (pango_x_get_coverage_win): * pango/pangox.c (itemize_string_foreach): Fix warnings. svn path=/trunk/; revision=2444
* Clarify docs.Behdad Esfahbod2007-06-151-1/+3
| | | | svn path=/trunk/; revision=2356
* Bug 446355 – the parsing with pango_parse_markup is not coherentBehdad Esfahbod2007-06-111-1/+1
| | | | | | | | | | | | | | | 2007-06-11 Behdad Esfahbod <behdad@gnome.org> Bug 446355 – the parsing with pango_parse_markup is not coherent * pango/pango-markup.c (pango_parse_markup): Use pango_attr_list_insert() instead of pango_attr_list_change() as merging adjacent attributes of the same kind is not a safe operation and can change the derived font of a segment in an unexpected and incorrect way. svn path=/trunk/; revision=2340
* *.c, *.h: Replace preceding sequences of 8 spaces with tabs.Behdad Esfahbod2007-01-161-425/+425
| | | | | | | | | 2007-01-16 Behdad Esfahbod <behdad@gnome.org> *.c, *.h: Replace preceding sequences of 8 spaces with tabs. svn path=/trunk/; revision=2165
* *.c, *.h: Drop trailing whitespace.Behdad Esfahbod2007-01-161-47/+47
| | | | | | | | | 2007-01-16 Behdad Esfahbod <behdad@gnome.org> *.c, *.h: Drop trailing whitespace. svn path=/trunk/; revision=2163
* New attribute types PANGO_ATTR_GRAVITY and PANGO_ATTR_GRAVITY_HINT. NewBehdad Esfahbod2007-01-161-257/+270
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2007-01-16 Behdad Esfahbod <behdad@gnome.org> * pango/pango-attributes.h: * pango/pango-attributes.c: New attribute types PANGO_ATTR_GRAVITY and PANGO_ATTR_GRAVITY_HINT. New public functions: pango_attr_gravity_new() pango_attr_gravity_hint_new() * pango/pango-context.c (update_attr_iterator), (itemize_state_init), (itemize_state_add_character), (get_shaper_and_font), (itemize_state_update_for_new_run): Handle gravity and gravity_hint attributes. * pango/pango-utils.h: * pango/pango-utils.c: New public function: pango_parse_enum() * pango/pango-markup.c (span_parse_func): Parse gravity and gravity_hint attributes for <span>. Optimize a bit. * pango/pango-markup.c (parse_absolute_size), (attr_strcmp), (span_parse_int), (span_parse_boolean), (span_parse_color), (span_parse_enum), (span_parse_func): Use pango_scan_int(), pango_color_parse(), and pango_parse_enum(). Also, ignore '-' and '_' differences when matching attribute names for <span>. * examples/renderdemo.c (parse_enum), (parse_ellipsis), (parse_gravity), (parse_gravity_hint), (parse_hinting), (parse_wrap): Use a generic parse_enum() that uses pango_parse_enum(). * modules/basic/basic-fc.c (basic_engine_shape): * pango/pangofc-fontmap.c (pango_fc_make_pattern): Use PANGO_GRAVITY_IS_VERTICAL(). * pango/pango.def: * docs/pango-sections.txt: * docs/tmpl/text-attributes.sgml: * docs/tmpl/utils.sgml: Update. svn path=/trunk/; revision=2145
* Spell-check the docs.Behdad Esfahbod2007-01-071-3/+3
| | | | svn path=/trunk/; revision=2130
* Bug 340229 – pango_font_description_from_string does not do boundBehdad Esfahbod2006-05-011-1/+1
| | | | | | | | | | | | 2006-05-01 Behdad Esfahbod <behdad@gnome.org> Bug 340229 – pango_font_description_from_string does not do bound checking * pango/fonts.c (pango_font_description_set_size), (pango_font_description_set_absolute_size), (parse_size): * pango/pango-markup.c (span_parse_func): Don't accept negative font sizes, and make sure sizes don't overflow.
* Bug 337924 – cleanups for issues reported by various compilers PatchBehdad Esfahbod2006-04-111-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2006-04-11 Behdad Esfahbod <behdad@gnome.org> Bug 337924 – cleanups for issues reported by various compilers Patch from Kjartan Maraas. * examples/viewer-x.c (update): * modules/arabic/arabic-fc.c (fallback_shape), (arabic_engine_shape): * modules/basic/basic-fc.c (fallback_shape), (basic_engine_shape): * modules/basic/basic-x.c: * modules/hangul/hangul-fc.c: * modules/hebrew/hebrew-fc.c (hebrew_engine_shape): * modules/indic/indic-fc.c: * modules/khmer/khmer-fc.c: * modules/syriac/syriac-fc.c: * modules/thai/thai-fc.c: * modules/tibetan/tibetan-fc.c: * pango/break.c: * pango/modules.c: * pango/opentype/ftglue.c (_hb_ftglue_face_goto_table): * pango/pango-attributes.c (pango_attr_list_filter): * pango/pango-engine.c: * pango/pango-fontset.c: * pango/pango-layout.c (pango_layout_set_text), (pango_layout_xy_to_index), (pango_layout_get_cursor_pos): * pango/pango-markup.c (text_handler): * pango/pango-utils.c (read_alias_file): * pango/pangocairo-fcfont.c (G_DEFINE_TYPE_WITH_CODE): * pango/pangocairo-fcfontmap.c (G_DEFINE_TYPE_WITH_CODE): * pango/pangocairo-font.c (_pango_cairo_font_get_hex_box_info): * pango/pangox-fontmap.c (pango_x_make_matching_xlfd): * tests/dump-boundaries.c (fail): Remove unused variables. Remove excess semicolon after DEFINE_TYPE macros.
* Make #include syntax in sources and headers more consistent. We are usingBehdad Esfahbod2006-03-311-3/+3
| | | | | | | | | 2006-03-30 Behdad Esfahbod <behdad@gnome.org> * pango/*.[ch]: Make #include syntax in sources and headers more consistent. We are using the "..." syntax for all Pango headers in source files, and <...> syntax in all header files, except for including private headers, that we use "...".
* Hook up pango-utils.h into the documentation, as we are installing itBehdad Esfahbod2006-03-311-1/+1
| | | | | | | | 2006-03-30 Behdad Esfahbod <behdad@gnome.org> Hook up pango-utils.h into the documentation, as we are installing it anyway. Move some internal stuff to pango-impl-utils.h and make source files include that instead.
* If locking font face failed, do not assert, just return zero glyphs withBehdad Esfahbod2006-01-291-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2006-01-29 Behdad Esfahbod <behdad@gnome.org> * modules/arabic/arabic-fc.c, modules/basic/basic-fc.c modules/hebrew/hebrew-fc.c, modules/indic/indic-fc.c modules/khmer/khmer-fc.c, modules/syriac/syriac-fc.c modules/thai/thai-ot.c, modules/thai/thai-shaper.c modules/tibetan/tibetan-fc.c: If locking font face failed, do not assert, just return zero glyphs with an implicit warning. * pango/fonts.c, pango/glyphstring.c pango/modules.c pango/pango-color.c, pango/pango-context.c pango/pango-coverage.c, pango/pango-fontmap.c pango/pango-glyph-item.c, pango/pango-item.c pango/pango-layout.c, pango/pango-markup.c pango/pango-ot-buffer.c, pango/pango-script.c pango/pango-tabs.c, pango/pango-utils.c pango/pangoatsui-fontmap.c, pango/pangocairo-fcfont.c pango/pangocairo-fcfontmap.c, pango/pangocairo-fontmap.c pango/pangocairo-win32font.c, pango/pangofc-font.c pango/pangofc-fontmap.c, pango/pangoft2-fontmap.c pango/pangoft2-render.c, pango/pangoft2.c pango/pangowin32-fontcache.c, pango/pangoxft-font.c pango/pangoxft-render.c, pango/break.c pango/ellipsize.c: Use g_slice for allocating all types. Also, change some g_error's to g_critical's...
* Make sure #include <config.h> is the first include in the file. (bugBehdad Esfahbod2006-01-141-0/+1
| | | | | | | 2006-01-14 Behdad Esfahbod <behdad@gnome.org> * */*.c, */*/*.c: Make sure #include <config.h> is the first include in the file. (bug #158870, based on patch by Luis Menina)