From 4d75f1ecca2fcab4cbfec9fb84c5b1f3647dbc17 Mon Sep 17 00:00:00 2001 From: Tomasz Boczkowski Date: Wed, 28 May 2014 23:28:17 +0200 Subject: SPPattern c++-sification: replaced function by methods (bzr r13341.6.21) --- src/desktop-style.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/desktop-style.cpp') diff --git a/src/desktop-style.cpp b/src/desktop-style.cpp index 37f537cc5..8c3dac382 100644 --- a/src/desktop-style.cpp +++ b/src/desktop-style.cpp @@ -538,8 +538,8 @@ objects_query_fillstroke (GSList *objects, SPStyle *style_res, bool const isfill if (!SP_IS_PATTERN(server)) return QUERY_STYLE_MULTIPLE_DIFFERENT; // different kind of server - SPPattern *pat = pattern_getroot (SP_PATTERN (server)); - SPPattern *pat_res = pattern_getroot (SP_PATTERN (server_res)); + SPPattern *pat = SP_PATTERN (server)->get_root(); + SPPattern *pat_res = SP_PATTERN (server_res)->get_root(); if (pat_res != pat) return QUERY_STYLE_MULTIPLE_DIFFERENT; // different pattern roots } -- cgit v1.2.3 From 705243e1266aec7527ae76065213ca7536ed7c41 Mon Sep 17 00:00:00 2001 From: Tomasz Boczkowski Date: Sun, 3 May 2015 12:37:06 +0200 Subject: renamed SPPattern methods to match coding style (bzr r14059.1.20) --- src/desktop-style.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/desktop-style.cpp') diff --git a/src/desktop-style.cpp b/src/desktop-style.cpp index 275165c9c..fb92ffaf5 100644 --- a/src/desktop-style.cpp +++ b/src/desktop-style.cpp @@ -576,8 +576,8 @@ objects_query_fillstroke (const std::vector &objects, SPStyle *style_re return QUERY_STYLE_MULTIPLE_DIFFERENT; // different kind of server } - SPPattern *pat = SP_PATTERN (server)->get_root(); - SPPattern *pat_res = SP_PATTERN (server_res)->get_root(); + SPPattern *pat = SP_PATTERN (server)->rootPattern(); + SPPattern *pat_res = SP_PATTERN (server_res)->rootPattern(); if (pat_res != pat) { return QUERY_STYLE_MULTIPLE_DIFFERENT; // different pattern roots } -- cgit v1.2.3 From c1b1d511b45348d8bccc5d22cd3471bb540cde12 Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Tue, 12 May 2015 21:43:24 +0200 Subject: GUI for font-variant-xxx, parse 'font-variant-ligatures'. This is a work in progress. (bzr r14148) --- src/desktop-style.cpp | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) (limited to 'src/desktop-style.cpp') diff --git a/src/desktop-style.cpp b/src/desktop-style.cpp index afdc3064a..118f983bb 100644 --- a/src/desktop-style.cpp +++ b/src/desktop-style.cpp @@ -1168,6 +1168,63 @@ objects_query_fontstyle (const std::vector &objects, SPStyle *style_res } } +int +objects_query_fontvariants (const std::vector &objects, SPStyle *style_res) +{ + bool set = false; + + int texts = 0; + + SPILigatures* ligatures_res = &(style_res->font_variant_ligatures); + ligatures_res->computed = + SP_CSS_FONT_VARIANT_LIGATURES_COMMON | + SP_CSS_FONT_VARIANT_LIGATURES_CONTEXTUAL; + ligatures_res->value = 0; + for (std::vector::const_iterator i = objects.begin(); i != objects.end(); i++) { + SPObject *obj = *i; + + if (!isTextualItem(obj)) { + continue; + } + + SPStyle *style = obj->style; + if (!style) { + continue; + } + + texts ++; + + SPILigatures* ligatures_in = &(style->font_variant_ligatures); + // computed stores which bits are on/off, only valid if same between all selected objects. + // value stores which bits are different between objects. This is a bit of an abuse of + // the values but then we don't need to add new variables to class. + if (set) { + ligatures_res->value |= (ligatures_res->computed ^ ligatures_in->computed ); + ligatures_res->computed &= ligatures_in->computed; + } else { + set = true; + ligatures_res->computed = ligatures_in->computed; + } + } + + bool different = (style_res->font_variant_position.value != + style_res->font_variant_position.computed ); + + if (texts == 0 || !set) + return QUERY_STYLE_NOTHING; + + if (texts > 1) { + if (different) { + return QUERY_STYLE_MULTIPLE_DIFFERENT; + } else { + return QUERY_STYLE_MULTIPLE_SAME; + } + } else { + return QUERY_STYLE_SINGLE; + } +} + + /** * Write to style_res the baseline numbers. */ @@ -1577,6 +1634,8 @@ sp_desktop_query_style_from_list (const std::vector &list, SPStyle *sty return objects_query_fontfamily (list, style); } else if (property == QUERY_STYLE_PROPERTY_FONTSTYLE) { return objects_query_fontstyle (list, style); + } else if (property == QUERY_STYLE_PROPERTY_FONTVARIANTS) { + return objects_query_fontvariants (list, style); } else if (property == QUERY_STYLE_PROPERTY_FONTNUMBERS) { return objects_query_fontnumbers (list, style); } else if (property == QUERY_STYLE_PROPERTY_BASELINES) { @@ -1598,6 +1657,7 @@ sp_desktop_query_style_from_list (const std::vector &list, SPStyle *sty int sp_desktop_query_style(SPDesktop *desktop, SPStyle *style, int property) { + // Used by text tool and in gradient dragging int ret = desktop->_query_style_signal.emit(style, property); if (ret != QUERY_STYLE_NOTHING) -- cgit v1.2.3 From ddf9853ed86846c5cc4e22a1ede31dafcda5c99d Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Sat, 16 May 2015 14:50:10 +0200 Subject: Enable setting of 'font-variant-position' and 'font-variant-caps'. Rendering awaits Pango update. (bzr r14155) --- src/desktop-style.cpp | 37 +++++++++++++++++++++++++++++++------ 1 file changed, 31 insertions(+), 6 deletions(-) (limited to 'src/desktop-style.cpp') diff --git a/src/desktop-style.cpp b/src/desktop-style.cpp index 118f983bb..f25ce8fa8 100644 --- a/src/desktop-style.cpp +++ b/src/desktop-style.cpp @@ -1176,10 +1176,19 @@ objects_query_fontvariants (const std::vector &objects, SPStyle *style_ int texts = 0; SPILigatures* ligatures_res = &(style_res->font_variant_ligatures); - ligatures_res->computed = - SP_CSS_FONT_VARIANT_LIGATURES_COMMON | - SP_CSS_FONT_VARIANT_LIGATURES_CONTEXTUAL; + SPIEnum* position_res = &(style_res->font_variant_position); + SPIEnum* caps_res = &(style_res->font_variant_caps); + + // Stores 'and' of all values + ligatures_res->computed = SP_CSS_FONT_VARIANT_LIGATURES_NORMAL; + position_res->computed = SP_CSS_FONT_VARIANT_POSITION_NORMAL; + caps_res->computed = SP_CSS_FONT_VARIANT_CAPS_NORMAL; + + // Stores only differences ligatures_res->value = 0; + position_res->value = 0; + caps_res->value = 0; + for (std::vector::const_iterator i = objects.begin(); i != objects.end(); i++) { SPObject *obj = *i; @@ -1195,20 +1204,36 @@ objects_query_fontvariants (const std::vector &objects, SPStyle *style_ texts ++; SPILigatures* ligatures_in = &(style->font_variant_ligatures); + SPIEnum* position_in = &(style->font_variant_position); + SPIEnum* caps_in = &(style->font_variant_caps); // computed stores which bits are on/off, only valid if same between all selected objects. // value stores which bits are different between objects. This is a bit of an abuse of // the values but then we don't need to add new variables to class. if (set) { ligatures_res->value |= (ligatures_res->computed ^ ligatures_in->computed ); ligatures_res->computed &= ligatures_in->computed; + + position_res->value |= (position_res->computed ^ position_in->computed ); + position_res->computed &= position_in->computed; + + caps_res->value |= (caps_res->computed ^ caps_in->computed ); + caps_res->computed &= caps_in->computed; + } else { - set = true; ligatures_res->computed = ligatures_in->computed; + position_res->computed = position_in->computed; + caps_res->computed = caps_in->computed; } + + set = true; } - bool different = (style_res->font_variant_position.value != - style_res->font_variant_position.computed ); + bool different = (style_res->font_variant_ligatures.value != + style_res->font_variant_ligatures.computed || + style_res->font_variant_position.value != + style_res->font_variant_position.computed || + style_res->font_variant_caps.value != + style_res->font_variant_caps.computed ); if (texts == 0 || !set) return QUERY_STYLE_NOTHING; -- cgit v1.2.3 From 7c7e740dd76054367ceae7f545ac27f0d7cdc7f0 Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Mon, 18 May 2015 21:50:54 +0200 Subject: Enable setting of 'font-variant-ligatures' (rendering waits on new Pango library). (bzr r14162) --- src/desktop-style.cpp | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) (limited to 'src/desktop-style.cpp') diff --git a/src/desktop-style.cpp b/src/desktop-style.cpp index 3bb0ce71a..d2109c03c 100644 --- a/src/desktop-style.cpp +++ b/src/desktop-style.cpp @@ -1178,17 +1178,20 @@ objects_query_fontvariants (const std::vector &objects, SPStyle *style_ SPILigatures* ligatures_res = &(style_res->font_variant_ligatures); SPIEnum* position_res = &(style_res->font_variant_position); SPIEnum* caps_res = &(style_res->font_variant_caps); - + SPINumeric* numeric_res = &(style_res->font_variant_numeric); + // Stores 'and' of all values ligatures_res->computed = SP_CSS_FONT_VARIANT_LIGATURES_NORMAL; position_res->computed = SP_CSS_FONT_VARIANT_POSITION_NORMAL; caps_res->computed = SP_CSS_FONT_VARIANT_CAPS_NORMAL; + numeric_res->computed = SP_CSS_FONT_VARIANT_NUMERIC_NORMAL; // Stores only differences ligatures_res->value = 0; position_res->value = 0; caps_res->value = 0; - + numeric_res->value = 0; + for (std::vector::const_iterator i = objects.begin(); i != objects.end(); i++) { SPObject *obj = *i; @@ -1204,8 +1207,9 @@ objects_query_fontvariants (const std::vector &objects, SPStyle *style_ texts ++; SPILigatures* ligatures_in = &(style->font_variant_ligatures); - SPIEnum* position_in = &(style->font_variant_position); - SPIEnum* caps_in = &(style->font_variant_caps); + SPIEnum* position_in = &(style->font_variant_position); + SPIEnum* caps_in = &(style->font_variant_caps); + SPINumeric* numeric_in = &(style->font_variant_numeric); // computed stores which bits are on/off, only valid if same between all selected objects. // value stores which bits are different between objects. This is a bit of an abuse of // the values but then we don't need to add new variables to class. @@ -1219,21 +1223,23 @@ objects_query_fontvariants (const std::vector &objects, SPStyle *style_ caps_res->value |= (caps_res->computed ^ caps_in->computed ); caps_res->computed &= caps_in->computed; + numeric_res->value |= (numeric_res->computed ^ numeric_in->computed ); + numeric_res->computed &= numeric_in->computed; + } else { ligatures_res->computed = ligatures_in->computed; - position_res->computed = position_in->computed; - caps_res->computed = caps_in->computed; + position_res->computed = position_in->computed; + caps_res->computed = caps_in->computed; + numeric_res->computed = numeric_in->computed; } set = true; } - bool different = (style_res->font_variant_ligatures.value != - style_res->font_variant_ligatures.computed || - style_res->font_variant_position.value != - style_res->font_variant_position.computed || - style_res->font_variant_caps.value != - style_res->font_variant_caps.computed ); + bool different = (style_res->font_variant_ligatures.value != 0 || + style_res->font_variant_position.value != 0 || + style_res->font_variant_caps.value != 0 || + style_res->font_variant_numeric.value != 0 ); if (texts == 0 || !set) return QUERY_STYLE_NOTHING; -- cgit v1.2.3