From 25a22169e6587f58856cc288b8967bc862013d26 Mon Sep 17 00:00:00 2001 From: Alvin Penner Date: Sat, 27 Sep 2014 07:39:25 -0400 Subject: transform text in text-on-path the same regardless of whether optimized or preserved (Bug 1279534) Fixed bugs: - https://launchpad.net/bugs/1279534 (bzr r13566) --- src/sp-item.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/sp-item.cpp b/src/sp-item.cpp index 19dc71785..71cdfa394 100644 --- a/src/sp-item.cpp +++ b/src/sp-item.cpp @@ -44,6 +44,7 @@ #include "sp-rect.h" #include "sp-use.h" #include "sp-text.h" +#include "sp-textpath.h" #include "sp-item-rm-unsatisfied-cns.h" #include "sp-pattern.h" #include "sp-paint-server.h" @@ -1407,10 +1408,11 @@ void SPItem::doWriteTransform(Inkscape::XML::Node *repr, Geom::Affine const &tra // onSetTransform cannot be pure due to the fact that not all visible Items are transformable. if ( // run the object's set_transform (i.e. embed transform) only if: - !preserve && // user did not chose to preserve all transforms + SP_IS_TEXT_TEXTPATH(this) || + (!preserve && // user did not chose to preserve all transforms (!clip_ref || !clip_ref->getObject()) && // the object does not have a clippath (!mask_ref || !mask_ref->getObject()) && // the object does not have a mask - !(!transform.isTranslation() && style && style->getFilter()) // the object does not have a filter, or the transform is translation (which is supposed to not affect filters) + !(!transform.isTranslation() && style && style->getFilter())) // the object does not have a filter, or the transform is translation (which is supposed to not affect filters) ) { transform_attr = this->set_transform(transform); -- cgit v1.2.3 From 538b22b4d5738d8232ad2ef685fb60a22a80118a Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Mon, 29 Sep 2014 09:24:40 +0200 Subject: Conditionally add 'semilight' due to changes in Pango 1.36.6. Curse Behdad. (bzr r13567) --- src/libnrtype/FontFactory.cpp | 4 ++++ src/libnrtype/FontInstance.cpp | 4 ++++ src/libnrtype/Layout-TNG-Output.cpp | 3 +++ src/libnrtype/font-lister.cpp | 5 +++++ 4 files changed, 16 insertions(+) (limited to 'src') diff --git a/src/libnrtype/FontFactory.cpp b/src/libnrtype/FontFactory.cpp index 6859a4a5c..2b7e1fa0c 100644 --- a/src/libnrtype/FontFactory.cpp +++ b/src/libnrtype/FontFactory.cpp @@ -857,6 +857,10 @@ font_instance *font_factory::Face(char const *family, NRTypePosDef apos) pango_font_description_set_weight(temp_descr, PANGO_WEIGHT_ULTRALIGHT); } else if ( apos.weight <= NR_POS_WEIGHT_LIGHT ) { pango_font_description_set_weight(temp_descr, PANGO_WEIGHT_LIGHT); +#if PANGO_VERSION_CHECK(1,36,6) + } else if ( apos.weight <= NR_POS_WEIGHT_SEMILIGHT ) { + pango_font_description_set_weight(temp_descr, PANGO_WEIGHT_SEMILIGHT); +#endif } else if ( apos.weight <= NR_POS_WEIGHT_BOOK ) { pango_font_description_set_weight(temp_descr, PANGO_WEIGHT_BOOK); } else if ( apos.weight <= NR_POS_WEIGHT_NORMAL ) { diff --git a/src/libnrtype/FontInstance.cpp b/src/libnrtype/FontInstance.cpp index 20eca6740..ce4c99ef7 100644 --- a/src/libnrtype/FontInstance.cpp +++ b/src/libnrtype/FontInstance.cpp @@ -311,6 +311,10 @@ unsigned int font_instance::Attribute(const gchar *key, gchar *str, unsigned int res=(char*)"200"; } else if ( v <= PANGO_WEIGHT_LIGHT ) { res=(char*)"300"; +#if PANGO_VERSION_CHECK(1,36,6) + } else if ( v <= PANGO_WEIGHT_SEMILIGHT ) { + res=(char*)"350"; +#endif } else if ( v <= PANGO_WEIGHT_BOOK ) { res=(char*)"380"; } else if ( v <= PANGO_WEIGHT_NORMAL ) { diff --git a/src/libnrtype/Layout-TNG-Output.cpp b/src/libnrtype/Layout-TNG-Output.cpp index 77534e706..61a141cc3 100644 --- a/src/libnrtype/Layout-TNG-Output.cpp +++ b/src/libnrtype/Layout-TNG-Output.cpp @@ -511,6 +511,9 @@ static char const *weight_to_text(PangoWeight w) case PANGO_WEIGHT_THIN : return "thin"; case PANGO_WEIGHT_ULTRALIGHT: return "ultralight"; case PANGO_WEIGHT_LIGHT : return "light"; +#if PANGO_VERSION_CHECK(1,36,6) + case PANGO_WEIGHT_SEMILIGHT : return "semilight"; +#endif case PANGO_WEIGHT_BOOK : return "book"; case PANGO_WEIGHT_NORMAL : return "normalweight"; case PANGO_WEIGHT_MEDIUM : return "medium"; diff --git a/src/libnrtype/font-lister.cpp b/src/libnrtype/font-lister.cpp index 43c3045b1..716f3c80a 100644 --- a/src/libnrtype/font-lister.cpp +++ b/src/libnrtype/font-lister.cpp @@ -623,6 +623,11 @@ std::pair FontLister::new_font_family (Glib::ustri case PANGO_WEIGHT_LIGHT: sp_repr_css_set_property (css, "font-weight", "300" ); break; +#if PANGO_VERSION_CHECK(1,36,6) + case PANGO_WEIGHT_SEMILIGHT: + sp_repr_css_set_property (css, "font-weight", "350" ); + break; +#endif case PANGO_WEIGHT_BOOK: sp_repr_css_set_property (css, "font-weight", "380" ); break; -- cgit v1.2.3 From 371fbc7dd70b32541696c063485e2a30dcceac0d Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Mon, 29 Sep 2014 10:18:36 +0200 Subject: Quick fix to unbreak build from last check in. (bzr r13568) --- src/libnrtype/nr-type-pos-def.cpp | 4 ++++ src/libnrtype/nr-type-pos-def.h | 1 + 2 files changed, 5 insertions(+) (limited to 'src') diff --git a/src/libnrtype/nr-type-pos-def.cpp b/src/libnrtype/nr-type-pos-def.cpp index fef04039e..ff633d5f1 100644 --- a/src/libnrtype/nr-type-pos-def.cpp +++ b/src/libnrtype/nr-type-pos-def.cpp @@ -46,6 +46,10 @@ parse_name_for_weight (char const *cc) weight = NR_POS_WEIGHT_ULTRA_LIGHT; } else if (strstr (c, "light")) { weight = NR_POS_WEIGHT_LIGHT; + } else if (strstr (c, "semi light")) { + weight = NR_POS_WEIGHT_SEMILIGHT; + } else if (strstr (c, "semilight")) { + weight = NR_POS_WEIGHT_SEMILIGHT; } else if (strstr (c, "book")) { weight = NR_POS_WEIGHT_BOOK; } else if (strstr (c, "medium")) { diff --git a/src/libnrtype/nr-type-pos-def.h b/src/libnrtype/nr-type-pos-def.h index ab9f5b45c..d4d412b21 100644 --- a/src/libnrtype/nr-type-pos-def.h +++ b/src/libnrtype/nr-type-pos-def.h @@ -9,6 +9,7 @@ #define NR_POS_WEIGHT_EXTRA_LIGHT 64 #define NR_POS_WEIGHT_ULTRA_LIGHT 64 #define NR_POS_WEIGHT_LIGHT 96 +#define NR_POS_WEIGHT_SEMILIGHT 96 #define NR_POS_WEIGHT_BOOK 128 #define NR_POS_WEIGHT_NORMAL 128 #define NR_POS_WEIGHT_MEDIUM 144 -- cgit v1.2.3 From 3c73700a91c6dc1561b3b70dcdc0c051d23405d3 Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Mon, 29 Sep 2014 15:57:21 +0200 Subject: Remove NRTypePosDef class and associated cruft. More direct CSS -> Pango translation. (bzr r13569) --- src/desktop-style.cpp | 6 +- src/libnrtype/CMakeLists.txt | 4 - src/libnrtype/FontFactory.cpp | 196 ++++++++++++++++---------- src/libnrtype/FontFactory.h | 3 - src/libnrtype/Makefile_insert | 4 - src/libnrtype/font-style-to-pos.cpp | 120 ---------------- src/libnrtype/font-style-to-pos.h | 21 --- src/libnrtype/nr-type-pos-def.cpp | 272 ------------------------------------ src/libnrtype/nr-type-pos-def.h | 103 -------------- src/sp-text.cpp | 1 - src/ui/dialog/text-edit.cpp | 1 - 11 files changed, 130 insertions(+), 601 deletions(-) delete mode 100644 src/libnrtype/font-style-to-pos.cpp delete mode 100644 src/libnrtype/font-style-to-pos.h delete mode 100644 src/libnrtype/nr-type-pos-def.cpp delete mode 100644 src/libnrtype/nr-type-pos-def.h (limited to 'src') diff --git a/src/desktop-style.cpp b/src/desktop-style.cpp index bfd662c9a..0b2e15d34 100644 --- a/src/desktop-style.cpp +++ b/src/desktop-style.cpp @@ -40,7 +40,6 @@ #include "sp-tspan.h" #include "xml/repr.h" #include "xml/sp-css-attr.h" -#include "libnrtype/font-style-to-pos.h" #include "sp-path.h" #include "ui/tools/tool-base.h" @@ -1098,7 +1097,10 @@ objects_query_fontstyle (GSList *objects, SPStyle *style_res) texts ++; if (set && - font_style_to_pos(*style_res).signature() != font_style_to_pos(*style).signature() ) { + ( ( style_res->font_weight.computed != style->font_weight.computed ) || + ( style_res->font_style.computed != style->font_style.computed ) || + ( style_res->font_stretch.computed != style->font_stretch.computed ) || + ( style_res->font_variant.computed != style->font_variant.computed ) ) ) { different = true; // different styles } diff --git a/src/libnrtype/CMakeLists.txt b/src/libnrtype/CMakeLists.txt index 84979d7ea..05fd01a03 100644 --- a/src/libnrtype/CMakeLists.txt +++ b/src/libnrtype/CMakeLists.txt @@ -3,14 +3,12 @@ set(nrtype_SRC FontFactory.cpp FontInstance.cpp font-lister.cpp - font-style-to-pos.cpp Layout-TNG.cpp Layout-TNG-Compute.cpp Layout-TNG-Input.cpp Layout-TNG-OutIter.cpp Layout-TNG-Output.cpp Layout-TNG-Scanline-Makers.cpp - nr-type-pos-def.cpp nr-type-primitives.cpp TextWrapper.cpp @@ -25,9 +23,7 @@ set(nrtype_SRC font-glyph.h font-instance.h font-lister.h - font-style-to-pos.h font-style.h - nr-type-pos-def.h nr-type-primitives.h one-box.h one-glyph.h diff --git a/src/libnrtype/FontFactory.cpp b/src/libnrtype/FontFactory.cpp index 2b7e1fa0c..fa452dd77 100644 --- a/src/libnrtype/FontFactory.cpp +++ b/src/libnrtype/FontFactory.cpp @@ -636,9 +636,133 @@ font_instance* font_factory::FaceFromStyle(SPStyle const *style) // If that failed, try using the CSS information in the style if (!font) { - font = Face(style->font_family.value, font_style_to_pos(*style)); + PangoFontDescription *temp_descr = pango_font_description_new(); - // That was a hatchet job... so we need to check if this font exists!! + pango_font_description_set_family(temp_descr, style->font_family.value); + + // This duplicates Layout::EnumConversionItem... perhaps we can share code? + switch ( style->font_style.computed ) { + case SP_CSS_FONT_STYLE_ITALIC: + pango_font_description_set_style(temp_descr, PANGO_STYLE_ITALIC); + break; + + case SP_CSS_FONT_STYLE_OBLIQUE: + pango_font_description_set_style(temp_descr, PANGO_STYLE_OBLIQUE); + break; + + case SP_CSS_FONT_STYLE_NORMAL: + default: + pango_font_description_set_style(temp_descr, PANGO_STYLE_NORMAL); + break; + } + + switch( style->font_weight.computed ) { + case SP_CSS_FONT_WEIGHT_100: + pango_font_description_set_weight(temp_descr, PANGO_WEIGHT_THIN); + break; + + case SP_CSS_FONT_WEIGHT_200: + pango_font_description_set_weight(temp_descr, PANGO_WEIGHT_ULTRALIGHT); + break; + + case SP_CSS_FONT_WEIGHT_300: + pango_font_description_set_weight(temp_descr, PANGO_WEIGHT_LIGHT); + break; + + case SP_CSS_FONT_WEIGHT_400: + case SP_CSS_FONT_WEIGHT_NORMAL: + pango_font_description_set_weight(temp_descr, PANGO_WEIGHT_NORMAL); + break; + + case SP_CSS_FONT_WEIGHT_500: + pango_font_description_set_weight(temp_descr, PANGO_WEIGHT_MEDIUM); + break; + + case SP_CSS_FONT_WEIGHT_600: + pango_font_description_set_weight(temp_descr, PANGO_WEIGHT_SEMIBOLD); + break; + + case SP_CSS_FONT_WEIGHT_700: + case SP_CSS_FONT_WEIGHT_BOLD: + pango_font_description_set_weight(temp_descr, PANGO_WEIGHT_BOLD); + break; + + case SP_CSS_FONT_WEIGHT_800: + pango_font_description_set_weight(temp_descr, PANGO_WEIGHT_ULTRABOLD); + break; + + case SP_CSS_FONT_WEIGHT_900: + pango_font_description_set_weight(temp_descr, PANGO_WEIGHT_HEAVY); + break; + + case SP_CSS_FONT_WEIGHT_LIGHTER: + case SP_CSS_FONT_WEIGHT_BOLDER: + default: + g_warning("FaceFromStyle: Unrecognized font_weight.computed value"); + pango_font_description_set_weight(temp_descr, PANGO_WEIGHT_NORMAL); + break; + } + // PANGO_WIEGHT_ULTRAHEAVY not used (not CSS2) + + switch (style->font_stretch.computed) { + case SP_CSS_FONT_STRETCH_ULTRA_CONDENSED: + pango_font_description_set_stretch(temp_descr, PANGO_STRETCH_ULTRA_CONDENSED); + break; + + case SP_CSS_FONT_STRETCH_EXTRA_CONDENSED: + pango_font_description_set_stretch(temp_descr, PANGO_STRETCH_EXTRA_CONDENSED); + break; + + case SP_CSS_FONT_STRETCH_CONDENSED: + pango_font_description_set_stretch(temp_descr, PANGO_STRETCH_CONDENSED); + break; + + case SP_CSS_FONT_STRETCH_SEMI_CONDENSED: + pango_font_description_set_stretch(temp_descr, PANGO_STRETCH_SEMI_CONDENSED); + break; + + case SP_CSS_FONT_STRETCH_NORMAL: + pango_font_description_set_stretch(temp_descr, PANGO_STRETCH_NORMAL); + break; + + case SP_CSS_FONT_STRETCH_SEMI_EXPANDED: + pango_font_description_set_stretch(temp_descr, PANGO_STRETCH_SEMI_EXPANDED); + break; + + case SP_CSS_FONT_STRETCH_EXPANDED: + pango_font_description_set_stretch(temp_descr, PANGO_STRETCH_EXPANDED); + break; + + case SP_CSS_FONT_STRETCH_EXTRA_EXPANDED: + pango_font_description_set_stretch(temp_descr, PANGO_STRETCH_EXTRA_EXPANDED); + break; + + case SP_CSS_FONT_STRETCH_ULTRA_EXPANDED: + pango_font_description_set_stretch(temp_descr, PANGO_STRETCH_ULTRA_EXPANDED); + + case SP_CSS_FONT_STRETCH_WIDER: + case SP_CSS_FONT_STRETCH_NARROWER: + default: + g_warning("FaceFromStyle: Unrecognized font_stretch.computed value"); + pango_font_description_set_stretch(temp_descr, PANGO_STRETCH_NORMAL); + break; + } + + switch ( style->font_variant.computed ) { + case SP_CSS_FONT_VARIANT_SMALL_CAPS: + pango_font_description_set_variant(temp_descr, PANGO_VARIANT_SMALL_CAPS); + break; + + case SP_CSS_FONT_VARIANT_NORMAL: + default: + pango_font_description_set_variant(temp_descr, PANGO_VARIANT_NORMAL); + break; + } + + font = Face(temp_descr); + pango_font_description_free(temp_descr); + + // We now find closest match to this font: Glib::ustring fontSpec = font_factory::Default()->ConstructFontSpecification(font); Glib::ustring newFontSpec = FontSpecificationBestMatch( fontSpec ); if( fontSpec != newFontSpec ) { @@ -831,74 +955,6 @@ font_instance *font_factory::Face(char const *family, int variant, int style, in return res; } -font_instance *font_factory::Face(char const *family, NRTypePosDef apos) -{ - PangoFontDescription *temp_descr = pango_font_description_new(); - - pango_font_description_set_family(temp_descr, family); - - if ( apos.variant == NR_POS_VARIANT_SMALLCAPS ) { - pango_font_description_set_variant(temp_descr, PANGO_VARIANT_SMALL_CAPS); - } else { - pango_font_description_set_variant(temp_descr, PANGO_VARIANT_NORMAL); - } - - if ( apos.italic ) { - pango_font_description_set_style(temp_descr, PANGO_STYLE_ITALIC); - } else if ( apos.oblique ) { - pango_font_description_set_style(temp_descr, PANGO_STYLE_OBLIQUE); - } else { - pango_font_description_set_style(temp_descr, PANGO_STYLE_NORMAL); - } - - if ( apos.weight <= NR_POS_WEIGHT_THIN ) { - pango_font_description_set_weight(temp_descr, PANGO_WEIGHT_THIN); - } else if ( apos.weight <= NR_POS_WEIGHT_ULTRA_LIGHT ) { - pango_font_description_set_weight(temp_descr, PANGO_WEIGHT_ULTRALIGHT); - } else if ( apos.weight <= NR_POS_WEIGHT_LIGHT ) { - pango_font_description_set_weight(temp_descr, PANGO_WEIGHT_LIGHT); -#if PANGO_VERSION_CHECK(1,36,6) - } else if ( apos.weight <= NR_POS_WEIGHT_SEMILIGHT ) { - pango_font_description_set_weight(temp_descr, PANGO_WEIGHT_SEMILIGHT); -#endif - } else if ( apos.weight <= NR_POS_WEIGHT_BOOK ) { - pango_font_description_set_weight(temp_descr, PANGO_WEIGHT_BOOK); - } else if ( apos.weight <= NR_POS_WEIGHT_NORMAL ) { - pango_font_description_set_weight(temp_descr, PANGO_WEIGHT_NORMAL); - } else if ( apos.weight <= NR_POS_WEIGHT_MEDIUM ) { - pango_font_description_set_weight(temp_descr, PANGO_WEIGHT_MEDIUM); - } else if ( apos.weight <= NR_POS_WEIGHT_SEMIBOLD ) { - pango_font_description_set_weight(temp_descr, PANGO_WEIGHT_SEMIBOLD); - } else if ( apos.weight <= NR_POS_WEIGHT_BOLD ) { - pango_font_description_set_weight(temp_descr, PANGO_WEIGHT_BOLD); - } else if ( apos.weight <= NR_POS_WEIGHT_ULTRA_BOLD ) { - pango_font_description_set_weight(temp_descr, PANGO_WEIGHT_ULTRABOLD); - } else { - pango_font_description_set_weight(temp_descr, PANGO_WEIGHT_HEAVY); - } - // PANGO_WIEGHT_ULTRAHEAVY not used (not CSS2) - - if ( apos.stretch <= NR_POS_STRETCH_ULTRA_CONDENSED ) { - pango_font_description_set_stretch(temp_descr, PANGO_STRETCH_EXTRA_CONDENSED); - } else if ( apos.stretch <= NR_POS_STRETCH_CONDENSED ) { - pango_font_description_set_stretch(temp_descr, PANGO_STRETCH_CONDENSED); - } else if ( apos.stretch <= NR_POS_STRETCH_SEMI_CONDENSED ) { - pango_font_description_set_stretch(temp_descr, PANGO_STRETCH_SEMI_CONDENSED); - } else if ( apos.stretch <= NR_POS_STRETCH_NORMAL ) { - pango_font_description_set_stretch(temp_descr, PANGO_STRETCH_NORMAL); - } else if ( apos.stretch <= NR_POS_STRETCH_SEMI_EXPANDED ) { - pango_font_description_set_stretch(temp_descr, PANGO_STRETCH_SEMI_EXPANDED); - } else if ( apos.stretch <= NR_POS_STRETCH_EXPANDED ) { - pango_font_description_set_stretch(temp_descr, PANGO_STRETCH_EXPANDED); - } else { - pango_font_description_set_stretch(temp_descr, PANGO_STRETCH_EXTRA_EXPANDED); - } - - font_instance *res = Face(temp_descr); - pango_font_description_free(temp_descr); - return res; -} - void font_factory::UnrefFace(font_instance *who) { if ( who ) { diff --git a/src/libnrtype/FontFactory.h b/src/libnrtype/FontFactory.h index 513ee4bf7..bb3a8fa25 100644 --- a/src/libnrtype/FontFactory.h +++ b/src/libnrtype/FontFactory.h @@ -21,8 +21,6 @@ #include #include "nr-type-primitives.h" -#include "nr-type-pos-def.h" -#include "font-style-to-pos.h" #include "../style.h" /* Freetype */ @@ -138,7 +136,6 @@ public: int variant=PANGO_VARIANT_NORMAL, int style=PANGO_STYLE_NORMAL, int weight=PANGO_WEIGHT_NORMAL, int stretch=PANGO_STRETCH_NORMAL, int size=10, int spacing=0); - font_instance* Face(char const *family, NRTypePosDef apos); /// Semi-private: tells the font_factory taht the font_instance 'who' has died and should be removed from loadedFaces void UnrefFace(font_instance* who); diff --git a/src/libnrtype/Makefile_insert b/src/libnrtype/Makefile_insert index 0ce8f1fd5..ab9465daa 100644 --- a/src/libnrtype/Makefile_insert +++ b/src/libnrtype/Makefile_insert @@ -2,13 +2,9 @@ ink_common_sources += \ libnrtype/boundary-type.h \ - libnrtype/font-style-to-pos.cpp \ - libnrtype/font-style-to-pos.h \ libnrtype/font-glyph.h \ libnrtype/font-instance.h \ libnrtype/font-style.h \ - libnrtype/nr-type-pos-def.cpp \ - libnrtype/nr-type-pos-def.h \ libnrtype/nr-type-primitives.cpp \ libnrtype/nr-type-primitives.h \ libnrtype/FontFactory.cpp \ diff --git a/src/libnrtype/font-style-to-pos.cpp b/src/libnrtype/font-style-to-pos.cpp deleted file mode 100644 index 02f5ef37c..000000000 --- a/src/libnrtype/font-style-to-pos.cpp +++ /dev/null @@ -1,120 +0,0 @@ -#include "font-style-to-pos.h" -#include - -/* 'lighter' and 'darker' have to be resolved earlier */ -/** -Given a style struct (CSS representation), sets the corresponding fields in a NRTypePosDef. - */ -NRTypePosDef -font_style_to_pos (SPStyle const &style) -{ - NRTypePosDef ret; - - switch (style.font_weight.computed) { - case SP_CSS_FONT_WEIGHT_100: - ret.weight = NR_POS_WEIGHT_CSS100; - break; - - case SP_CSS_FONT_WEIGHT_200: - ret.weight = NR_POS_WEIGHT_CSS200; - break; - - case SP_CSS_FONT_WEIGHT_300: - ret.weight = NR_POS_WEIGHT_CSS300; - break; - - case SP_CSS_FONT_WEIGHT_400: - case SP_CSS_FONT_WEIGHT_NORMAL: - ret.weight = NR_POS_WEIGHT_CSS400; - break; - - case SP_CSS_FONT_WEIGHT_500: - ret.weight = NR_POS_WEIGHT_CSS500; - break; - - case SP_CSS_FONT_WEIGHT_600: - ret.weight = NR_POS_WEIGHT_CSS600; - break; - - case SP_CSS_FONT_WEIGHT_700: - case SP_CSS_FONT_WEIGHT_BOLD: - ret.weight = NR_POS_WEIGHT_CSS700; - break; - - case SP_CSS_FONT_WEIGHT_800: - ret.weight = NR_POS_WEIGHT_CSS800; - break; - - case SP_CSS_FONT_WEIGHT_900: - ret.weight = NR_POS_WEIGHT_CSS900; - break; - - case SP_CSS_FONT_WEIGHT_LIGHTER: - case SP_CSS_FONT_WEIGHT_BOLDER: - default: - g_warning("Unrecognized font_weight.computed value"); - ret.weight = NR_POS_WEIGHT_NORMAL; - break; - } - - switch (style.font_style.computed) { - case SP_CSS_FONT_STYLE_ITALIC: - ret.italic = 1; - break; - - case SP_CSS_FONT_STYLE_OBLIQUE: - ret.oblique = 1; - break; - - case SP_CSS_FONT_STYLE_NORMAL: - default: - ret.italic = 0; - ret.oblique = 0; - break; - } - - switch (style.font_stretch.computed) { - case SP_CSS_FONT_STRETCH_ULTRA_CONDENSED: - case SP_CSS_FONT_STRETCH_EXTRA_CONDENSED: - ret.stretch = NR_POS_STRETCH_EXTRA_CONDENSED; - break; - - case SP_CSS_FONT_STRETCH_CONDENSED: - case SP_CSS_FONT_STRETCH_NARROWER: - ret.stretch = NR_POS_STRETCH_CONDENSED; - break; - - case SP_CSS_FONT_STRETCH_SEMI_CONDENSED: - ret.stretch = NR_POS_STRETCH_SEMI_CONDENSED; - break; - - case SP_CSS_FONT_STRETCH_SEMI_EXPANDED: - ret.stretch = NR_POS_STRETCH_SEMI_EXPANDED; - break; - - case SP_CSS_FONT_STRETCH_EXPANDED: - case SP_CSS_FONT_STRETCH_WIDER: - ret.stretch = NR_POS_STRETCH_EXPANDED; - break; - - case SP_CSS_FONT_STRETCH_EXTRA_EXPANDED: - case SP_CSS_FONT_STRETCH_ULTRA_EXPANDED: - ret.stretch = NR_POS_STRETCH_EXTRA_EXPANDED; - break; - - default: - ret.stretch = NR_POS_STRETCH_NORMAL; - break; - } - - switch (style.font_variant.computed) { - case SP_CSS_FONT_VARIANT_SMALL_CAPS: - ret.variant = NR_POS_VARIANT_SMALLCAPS; - break; - default: - ret.variant = NR_POS_VARIANT_NORMAL; - break; - } - - return ret; -} diff --git a/src/libnrtype/font-style-to-pos.h b/src/libnrtype/font-style-to-pos.h deleted file mode 100644 index 41ba6cf72..000000000 --- a/src/libnrtype/font-style-to-pos.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef SEEN_FONT_STYLE_TO_POS_H -#define SEEN_FONT_STYLE_TO_POS_H - -#include - -class SPStyle; - -NRTypePosDef font_style_to_pos(SPStyle const &style); - -#endif // SEEN_FONT_STYLE_TO_POS_H - -/* - Local Variables: - mode:c++ - c-file-style:"stroustrup" - c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) - indent-tabs-mode:nil - fill-column:99 - End: -*/ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/libnrtype/nr-type-pos-def.cpp b/src/libnrtype/nr-type-pos-def.cpp deleted file mode 100644 index ff633d5f1..000000000 --- a/src/libnrtype/nr-type-pos-def.cpp +++ /dev/null @@ -1,272 +0,0 @@ -#include "nr-type-pos-def.h" -#include -#include - -/** - * Given a font name or style name, returns a constant describing its - * apparent style (normal/italic/oblique). -*/ -int -parse_name_for_style (char const *cc) -{ - g_assert ( cc != NULL ); - gchar *c = g_ascii_strdown (cc, -1); - - gint style; - // first dab at i18n... french and german - if (strstr (c, "italic") || strstr (c, "italique") || strstr (c, "kursiv")) { - style = NR_POS_STYLE_ITALIC; - } else if (strstr (c, "oblique")) { - style = NR_POS_STYLE_OBLIQUE; - } else { - style = NR_POS_STYLE_NORMAL; - } - - g_free (c); - return style; -} - - -/** - * Given a font name or style name, returns a constant describing its - * apparent weight. -*/ -int -parse_name_for_weight (char const *cc) -{ - g_assert ( cc != NULL ); - gchar *c = g_ascii_strdown (cc, -1); - - gint weight; - if (strstr (c, "thin")) { - weight = NR_POS_WEIGHT_THIN; - } else if (strstr (c, "extra light")) { - weight = NR_POS_WEIGHT_EXTRA_LIGHT; - } else if (strstr (c, "ultra light")) { - weight = NR_POS_WEIGHT_ULTRA_LIGHT; - } else if (strstr (c, "light")) { - weight = NR_POS_WEIGHT_LIGHT; - } else if (strstr (c, "semi light")) { - weight = NR_POS_WEIGHT_SEMILIGHT; - } else if (strstr (c, "semilight")) { - weight = NR_POS_WEIGHT_SEMILIGHT; - } else if (strstr (c, "book")) { - weight = NR_POS_WEIGHT_BOOK; - } else if (strstr (c, "medium")) { - weight = NR_POS_WEIGHT_MEDIUM; - } else if (strstr (c, "semi bold")) { - weight = NR_POS_WEIGHT_SEMIBOLD; - } else if (strstr (c, "semibold")) { - weight = NR_POS_WEIGHT_SEMIBOLD; - } else if (strstr (c, "demi bold")) { - weight = NR_POS_WEIGHT_DEMIBOLD; - } else if (strstr (c, "demibold") || strstr (c, "demi")) { - weight = NR_POS_WEIGHT_DEMIBOLD; - } else if (strstr (c, "ultra bold")) { - weight = NR_POS_WEIGHT_ULTRA_BOLD; - } else if (strstr (c, "extra bold") || strstr (c, "xbold") || strstr (c, "xtrabold")) { - weight = NR_POS_WEIGHT_EXTRA_BOLD; - } else if (strstr (c, "black") || strstr (c, "heavy")) { - weight = NR_POS_WEIGHT_BLACK; - } else if (strstr (c, "bold")) { - /* Must come after the checks for `blah bold'. */ - weight = NR_POS_WEIGHT_BOLD; - } else { - weight = NR_POS_WEIGHT_NORMAL; - } - - g_free (c); - return weight; -} - -/** - * Given a font name or style name, returns a constant describing its - * apparent stretch. -*/ -int -parse_name_for_stretch (char const *cc) -{ - g_assert ( cc != NULL ); - gchar *c = g_ascii_strdown (cc, -1); - - gint stretch; - if (strstr (c, "ultra narrow") || strstr (c, "ultra condensed") || strstr (c, "extra condensed")) { - stretch = NR_POS_STRETCH_EXTRA_CONDENSED; - } else if (strstr (c, "ultra wide") || strstr (c, "ultra expanded") || strstr (c, "ultra extended") || strstr (c, "extra expanded")) { - stretch = NR_POS_STRETCH_EXTRA_EXPANDED; - } else if (strstr (c, "semi condensed") || strstr (c, "semicondensed")) { - stretch = NR_POS_STRETCH_SEMI_CONDENSED; - } else if (strstr (c, "semi extended") || strstr (c, "semiextended")) { - stretch = NR_POS_STRETCH_SEMI_EXPANDED; - } else if (strstr (c, "narrow") || strstr (c, "condensed")) { - stretch = NR_POS_STRETCH_CONDENSED; - } else if (strstr (c, "wide") || strstr (c, "expanded") || strstr (c, "extended")) { - stretch = NR_POS_STRETCH_EXPANDED; - } else { - stretch = NR_POS_STRETCH_NORMAL; - } - - g_free (c); - return stretch; -} - -/** - * Given a font name or style name, returns a constant describing its - * apparent variant (normal/smallcaps). -*/ -int -parse_name_for_variant (char const *cc) -{ - g_assert ( cc != NULL ); - gchar *c = g_ascii_strdown (cc, -1); - - gint variant; - if (strstr (c, "small caps") || strstr (c, "smallcaps") || strstr (c, "caps")) { - variant = NR_POS_VARIANT_SMALLCAPS; - } else { - variant = NR_POS_VARIANT_NORMAL; - } - - g_free (c); - return variant; -} - -/** - * Given a style constant, returns the CSS value for font-style. -*/ -const char * -style_to_css (int style) -{ - switch (style) { - case NR_POS_STYLE_NORMAL: - return "normal"; - break; - case NR_POS_STYLE_ITALIC: - return "italic"; - break; - case NR_POS_STYLE_OBLIQUE: - return "oblique"; - break; - default: - break; - } - return NULL; -} - - -/** - * Given a weight constant, returns the CSS value for font-weight. -*/ -const char * -weight_to_css (int weight) -{ - switch (weight) { - case NR_POS_WEIGHT_THIN: - return "100"; - break; - case NR_POS_WEIGHT_EXTRA_LIGHT: - return "200"; - break; - case NR_POS_WEIGHT_LIGHT: - return "300"; - break; - case NR_POS_WEIGHT_BOOK: - return "normal"; - break; - case NR_POS_WEIGHT_MEDIUM: - return "500"; - break; - case NR_POS_WEIGHT_SEMIBOLD: - return "600"; - break; - case NR_POS_WEIGHT_BOLD: - return "bold"; - break; - case NR_POS_WEIGHT_EXTRA_BOLD: - return "800"; - break; - case NR_POS_WEIGHT_BLACK: - return "900"; - break; - default: - break; - } - return NULL; -} - -/** - * Given a stretch constant, returns the CSS value for font-stretch. -*/ -const char * -stretch_to_css (int stretch) -{ - switch (stretch) { - case NR_POS_STRETCH_EXTRA_CONDENSED: - return "extra-condensed"; - break; - case NR_POS_STRETCH_CONDENSED: - return "condensed"; - break; - case NR_POS_STRETCH_SEMI_CONDENSED: - return "semi-condensed"; - break; - case NR_POS_STRETCH_NORMAL: - return "normal"; - break; - case NR_POS_STRETCH_SEMI_EXPANDED: - return "semi-expanded"; - break; - case NR_POS_STRETCH_EXPANDED: - return "expanded"; - break; - case NR_POS_STRETCH_EXTRA_EXPANDED: - return "extra-expanded"; - break; - default: - break; - } - return NULL; -} - -/** - * Given a variant constant, returns the CSS value for font-variant. -*/ -const char * -variant_to_css (int stretch) -{ - switch (stretch) { - case NR_POS_VARIANT_SMALLCAPS: - return "small-caps"; - break; - case NR_POS_VARIANT_NORMAL: - return "normal"; - break; - default: - break; - } - return NULL; -} - - -/** - * Constructor for NRTypePostDef. Sets the italic, oblique, weight, - * stretch, and variant. - */ -NRTypePosDef::NRTypePosDef(char const *description) { - // we cannot use strcasestr, it's linux only... so we must lowercase the string first - g_assert ( description != NULL ); - gchar *c = g_ascii_strdown (description, -1); - - /* copied from nr-type-directory.cpp:nr_type_calculate_position. */ - - italic = (strstr (c, "italic") != NULL); - oblique = (strstr (c, "oblique") != NULL); - - weight = parse_name_for_weight (c); - - stretch = parse_name_for_stretch (c); - - variant = parse_name_for_variant (c); - - g_free (c); -} diff --git a/src/libnrtype/nr-type-pos-def.h b/src/libnrtype/nr-type-pos-def.h deleted file mode 100644 index d4d412b21..000000000 --- a/src/libnrtype/nr-type-pos-def.h +++ /dev/null @@ -1,103 +0,0 @@ -#ifndef __NR_TYPE_POS_DEF_H__ -#define __NR_TYPE_POS_DEF_H__ - -#define NR_POS_STYLE_NORMAL 0 -#define NR_POS_STYLE_ITALIC 1 -#define NR_POS_STYLE_OBLIQUE 2 - -#define NR_POS_WEIGHT_THIN 32 -#define NR_POS_WEIGHT_EXTRA_LIGHT 64 -#define NR_POS_WEIGHT_ULTRA_LIGHT 64 -#define NR_POS_WEIGHT_LIGHT 96 -#define NR_POS_WEIGHT_SEMILIGHT 96 -#define NR_POS_WEIGHT_BOOK 128 -#define NR_POS_WEIGHT_NORMAL 128 -#define NR_POS_WEIGHT_MEDIUM 144 -#define NR_POS_WEIGHT_SEMIBOLD 160 -#define NR_POS_WEIGHT_DEMIBOLD 160 -#define NR_POS_WEIGHT_BOLD 192 -#define NR_POS_WEIGHT_ULTRA_BOLD 224 -#define NR_POS_WEIGHT_EXTRA_BOLD 224 -#define NR_POS_WEIGHT_BLACK 255 - -#define NR_POS_STRETCH_ULTRA_CONDENSED 48 -#define NR_POS_STRETCH_EXTRA_CONDENSED 48 -#define NR_POS_STRETCH_CONDENSED 88 -#define NR_POS_STRETCH_SEMI_CONDENSED 108 -#define NR_POS_STRETCH_NORMAL 128 -#define NR_POS_STRETCH_SEMI_EXPANDED 148 -#define NR_POS_STRETCH_EXPANDED 168 -#define NR_POS_STRETCH_EXTRA_EXPANDED 228 -#define NR_POS_STRETCH_ULTRA_EXPANDED 228 - -// This is an enumerate, rather than on/off property, -// for I sincerely hope the vocabulary of this property will be -// extended by the W3C in the future to allow for more fancy fonts -#define NR_POS_VARIANT_NORMAL 0 -#define NR_POS_VARIANT_SMALLCAPS 1 - -/* Mapping from CSS weight numbers. - - for i in `seq 9`; do - if [ $i -le 4 ]; then w=$((32 * $i)); - elif [ $i = 5 ]; then w=144; - elif [ $i -lt 9 ]; then w=$((32 * $(($i - 1)))); - else w=255; - fi; - printf '#define NR_POS_WEIGHT_CSS%d00\t\t%3d\n' $i $w; - done - - This calculation approximately matches the old to-and-from-text code, - I don't claim it to be reasonable. ("approximately": some of the old - code wrote strings like "semi" and "heavy" that weren't being parsed - at the other end, and it had CSS100 darker than CSS200.) - */ -#define NR_POS_WEIGHT_CSS100 32 -#define NR_POS_WEIGHT_CSS200 64 -#define NR_POS_WEIGHT_CSS300 96 -#define NR_POS_WEIGHT_CSS400 128 -#define NR_POS_WEIGHT_CSS500 144 -#define NR_POS_WEIGHT_CSS600 160 -#define NR_POS_WEIGHT_CSS700 192 -#define NR_POS_WEIGHT_CSS800 224 -#define NR_POS_WEIGHT_CSS900 255 - - -class NRTypePosDef { -public: - unsigned int italic : 1; - unsigned int oblique : 1; - unsigned int weight : 8; - unsigned int stretch : 8; - unsigned int variant : 8; - /* These can probably be made sensible sizes rather than bitfields; for the moment we'll - keep the old definition. */ - -public: - NRTypePosDef() : - italic(0), - oblique(0), - weight(NR_POS_WEIGHT_NORMAL), - stretch(NR_POS_STRETCH_NORMAL), - variant(NR_POS_VARIANT_NORMAL) - { } - - NRTypePosDef(char const *description); - - bool signature() {return this->italic + - this->oblique * 255 + - this->weight * 255 * 255 + - this->stretch * 255 * 255 * 255 + - this->variant * 255 * 255 * 255 * 255;}; -}; - -int parse_name_for_style (char const *c); -int parse_name_for_weight (char const *c); -int parse_name_for_stretch (char const *c); -int parse_name_for_variant (char const *c); -const char *style_to_css (int style); -const char *weight_to_css (int weight); -const char *stretch_to_css (int stretch); -const char *variant_to_css (int variant); - -#endif /* __NR_TYPE_POS_DEF_H__ */ diff --git a/src/sp-text.cpp b/src/sp-text.cpp index ccc5adf59..23a3d26cd 100644 --- a/src/sp-text.cpp +++ b/src/sp-text.cpp @@ -30,7 +30,6 @@ #include <2geom/affine.h> #include #include -#include #include #include "svg/svg.h" diff --git a/src/ui/dialog/text-edit.cpp b/src/ui/dialog/text-edit.cpp index c1ebb32e0..a00db1715 100644 --- a/src/ui/dialog/text-edit.cpp +++ b/src/ui/dialog/text-edit.cpp @@ -32,7 +32,6 @@ extern "C" { #include #include -#include #include #include -- cgit v1.2.3 From 1c5ca3d7db2292b8491135c9f1dfcbba3b4c5dd4 Mon Sep 17 00:00:00 2001 From: "Liam P. White" Date: Tue, 30 Sep 2014 21:28:03 -0400 Subject: Revert r13496 (regression -- needs more work) Fixed bugs: - https://launchpad.net/bugs/1357805 (bzr r13570) --- src/document-undo.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/document-undo.cpp b/src/document-undo.cpp index 53e701648..8d3232738 100644 --- a/src/document-undo.cpp +++ b/src/document-undo.cpp @@ -255,7 +255,7 @@ gboolean Inkscape::DocumentUndo::undo(SPDocument *doc) Inkscape::Event *log=(Inkscape::Event *)doc->priv->undo->data; doc->priv->undo = g_slist_remove (doc->priv->undo, log); sp_repr_undo_log (log->event); - doc->_updateDocument(); + //doc->_updateDocument(); doc->priv->redo = g_slist_prepend (doc->priv->redo, log); doc->setModifiedSinceSave(); -- cgit v1.2.3 From 0b7731f9d93442ba18df146b85ce46bdb0c21220 Mon Sep 17 00:00:00 2001 From: Nicolas Dufour Date: Wed, 1 Oct 2014 09:00:39 +0200 Subject: Fix for bug #690255 (Rename te_IN.po to te.po). Fixed bugs: - https://launchpad.net/bugs/690255 (bzr r13571) --- src/ui/dialog/inkscape-preferences.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index 7d43adc0f..8d43358a7 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -526,11 +526,11 @@ void InkscapePreferences::initPageUI() _("Mongolian (mn)"), _("Nepali (ne)"), _("Norwegian Bokmål (nb)"), _("Norwegian Nynorsk (nn)"), _("Panjabi (pa)"), _("Polish (pl)"), _("Portuguese (pt)"), _("Portuguese/Brazil (pt_BR)"), _("Romanian (ro)"), _("Russian (ru)"), _("Serbian (sr)"), _("Serbian in Latin script (sr@latin)"), _("Slovak (sk)"), _("Slovenian (sl)"), _("Spanish (es)"), _("Spanish/Mexico (es_MX)"), - _("Swedish (sv)"),_("Telugu (te_IN)"), _("Thai (th)"), _("Turkish (tr)"), _("Ukrainian (uk)"), _("Vietnamese (vi)")}; + _("Swedish (sv)"),_("Telugu (te)"), _("Thai (th)"), _("Turkish (tr)"), _("Ukrainian (uk)"), _("Vietnamese (vi)")}; Glib::ustring langValues[] = {"", "sq", "am", "ar", "hy", "az", "eu", "be", "bg", "bn", "bn_BD", "br", "ca", "ca@valencia", "zh_CN", "zh_TW", "hr", "cs", "da", "nl", "dz", "de", "el", "en", "en_AU", "en_CA", "en_GB", "en_US@piglatin", "eo", "et", "fa", "fi", "fr", "ga", "gl", "he", "hu", "id", "it", "ja", "km", "rw", "ko", "lt", "lv", "mk", "mn", "ne", "nb", "nn", "pa", - "pl", "pt", "pt_BR", "ro", "ru", "sr", "sr@latin", "sk", "sl", "es", "es_MX", "sv", "te_IN", "th", "tr", "uk", "vi" }; + "pl", "pt", "pt_BR", "ro", "ru", "sr", "sr@latin", "sk", "sl", "es", "es_MX", "sv", "te", "th", "tr", "uk", "vi" }; { // sorting languages according to translated name -- cgit v1.2.3 From 5939979ab65640db5575ba78f3287c6767577257 Mon Sep 17 00:00:00 2001 From: Nicolas Dufour Date: Wed, 1 Oct 2014 09:13:38 +0200 Subject: Fix for Bug #1358520 (show/hide other layers not properly recorded in undo history). Fixed bugs: - https://launchpad.net/bugs/1358520 (bzr r13572) --- src/verbs.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/verbs.cpp b/src/verbs.cpp index 0c329cab8..ab0fc8d71 100644 --- a/src/verbs.cpp +++ b/src/verbs.cpp @@ -1402,7 +1402,7 @@ void LayerVerb::perform(SPAction *action, void *data) dt->messageStack()->flash(Inkscape::ERROR_MESSAGE, _("No current layer.")); } else { dt->toggleLayerSolo( dt->currentLayer() ); - DocumentUndo::maybeDone(sp_desktop_document(dt), "layer:solo", SP_VERB_LAYER_SOLO, _("Toggle layer solo")); + DocumentUndo::done(sp_desktop_document(dt), SP_VERB_LAYER_SOLO, _("Toggle layer solo")); } break; } @@ -1426,7 +1426,7 @@ void LayerVerb::perform(SPAction *action, void *data) dt->messageStack()->flash(Inkscape::ERROR_MESSAGE, _("No current layer.")); } else { dt->toggleLockOtherLayers( dt->currentLayer() ); - DocumentUndo::maybeDone(sp_desktop_document(dt), "layer:lockothers", SP_VERB_LAYER_LOCK_OTHERS, _("Lock other layers")); + DocumentUndo::done(sp_desktop_document(dt), SP_VERB_LAYER_LOCK_OTHERS, _("Lock other layers")); } break; } -- cgit v1.2.3 From d4d9e436812558588342180c336deb74473cd6c0 Mon Sep 17 00:00:00 2001 From: Nicolas Dufour Date: Wed, 1 Oct 2014 09:24:30 +0200 Subject: Importing. Fix for Bug #1325822 (BMP images resolution not correctly imported). Fixed bugs: - https://launchpad.net/bugs/1325822 (bzr r13573) --- src/extension/internal/image-resolution.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src') diff --git a/src/extension/internal/image-resolution.cpp b/src/extension/internal/image-resolution.cpp index f092b21ef..e96fd6437 100644 --- a/src/extension/internal/image-resolution.cpp +++ b/src/extension/internal/image-resolution.cpp @@ -354,8 +354,15 @@ void ImageResolution::readmagick(char const *fn) { return; } + std::string const type = image.magick(); x_ = image.xResolution(); y_ = image.yResolution(); + +// TODO: find out why the hell the following convertion is necessary + if (type == "BMP") { + x_ = Inkscape::Util::Quantity::convert(x_, "in", "cm"); + y_ = Inkscape::Util::Quantity::convert(y_, "in", "cm"); + } if (x_ != 0 && y_ != 0) { ok_ = true; -- cgit v1.2.3 From 41eae39d1d81726f6ab98fe9da621ddf7bc922f0 Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Thu, 2 Oct 2014 09:53:41 +0200 Subject: Fix style string while searching for best face match. Fix typo for 'ultra-condensed' face in fontspec_from_style(). (bzr r13574) --- src/libnrtype/font-lister.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/libnrtype/font-lister.cpp b/src/libnrtype/font-lister.cpp index 716f3c80a..6727cdda6 100644 --- a/src/libnrtype/font-lister.cpp +++ b/src/libnrtype/font-lister.cpp @@ -796,7 +796,7 @@ std::pair FontLister::new_font_family (Glib::ustri switch (style->font_stretch.computed) { case SP_CSS_FONT_STRETCH_ULTRA_CONDENSED: - fontspec += " extra-condensed"; + fontspec += " ultra-condensed"; break; case SP_CSS_FONT_STRETCH_EXTRA_CONDENSED: @@ -985,7 +985,7 @@ std::pair FontLister::new_font_family (Glib::ustri GList* styles = row[FontList.styles]; for (GList *l=styles; l; l = l->next) { - Glib::ustring fontspec = family + ", " + (char*)l->data; + Glib::ustring fontspec = family + ", " + ((StyleNames *)l->data)->CssName; PangoFontDescription* candidate = pango_font_description_from_string( fontspec.c_str() ); //font_description_dump( candidate ); //std::cout << " " << font_description_better_match( target, best, candidate ) << std::endl; -- cgit v1.2.3 From 66fd1af880dddae1fa77e9c0cc22e475de4d54d2 Mon Sep 17 00:00:00 2001 From: Nicolas Dufour Date: Thu, 2 Oct 2014 10:04:45 +0200 Subject: Fixing inconsistencies in the PixelArt dialog. (bzr r13575) --- src/ui/dialog/pixelartdialog.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/ui/dialog/pixelartdialog.cpp b/src/ui/dialog/pixelartdialog.cpp index 2d25f54d7..5113f172a 100644 --- a/src/ui/dialog/pixelartdialog.cpp +++ b/src/ui/dialog/pixelartdialog.cpp @@ -385,8 +385,8 @@ void PixelArtDialogImpl::vectorize() if ( input.pixbuf->get_width() > 256 || input.pixbuf->get_height() > 256 ) { - char *msg = _("Image looks too big. Process may take a while and is" - " wise to save your document before continue." + char *msg = _("Image looks too big. Process may take a while and it is" + " wise to save your document before continuing." "\n\nContinue the procedure (without saving)?"); Gtk::MessageDialog dialog(msg, false, Gtk::MESSAGE_WARNING, Gtk::BUTTONS_OK_CANCEL, true); -- cgit v1.2.3 From 50a19700fb02a712803aa3623f0920d562116534 Mon Sep 17 00:00:00 2001 From: Nicolas Dufour Date: Thu, 2 Oct 2014 10:32:46 +0200 Subject: i18n. Fix for Bug #380522 (strings that need to be fixed for translation). Translations. Inkscape.pot and French translation update. Fixed bugs: - https://launchpad.net/bugs/380522 (bzr r13576) --- src/color-profile.cpp | 2 +- src/filter-enums.cpp | 2 +- src/live_effects/lpe-ruler.cpp | 2 +- src/ui/dialog/filter-effects-dialog.cpp | 2 +- src/ui/dialog/inkscape-preferences.cpp | 8 ++++---- src/ui/dialog/input.cpp | 2 +- src/ui/widget/selected-style.cpp | 6 +++++- src/verbs.cpp | 2 +- src/widgets/gradient-toolbar.cpp | 2 +- src/widgets/pencil-toolbar.cpp | 2 +- src/widgets/stroke-marker-selector.cpp | 2 +- 11 files changed, 18 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/color-profile.cpp b/src/color-profile.cpp index 6f335b590..28550b75d 100644 --- a/src/color-profile.cpp +++ b/src/color-profile.cpp @@ -911,7 +911,7 @@ Glib::ustring getNameFromProfile(cmsHPROFILE profile) if ( name && !g_utf8_validate(name, -1, NULL) ) { name = _("(invalid UTF-8 string)"); } - nameStr = (name) ? name : _("None"); + nameStr = (name) ? name : C_("Profile name", "None"); #elif HAVE_LIBLCMS2 cmsUInt32Number byteLen = cmsGetProfileInfo(profile, cmsInfoDescription, "en", "US", NULL, 0); if (byteLen > 0) { diff --git a/src/filter-enums.cpp b/src/filter-enums.cpp index 09a1a7614..67ca7b6e7 100644 --- a/src/filter-enums.cpp +++ b/src/filter-enums.cpp @@ -118,7 +118,7 @@ const EnumDataConverter Componen const EnumData ConvolveMatrixEdgeModeData[Inkscape::Filters::CONVOLVEMATRIX_EDGEMODE_ENDTYPE] = { {Inkscape::Filters::CONVOLVEMATRIX_EDGEMODE_DUPLICATE, _("Duplicate"), "duplicate"}, {Inkscape::Filters::CONVOLVEMATRIX_EDGEMODE_WRAP, _("Wrap"), "wrap"}, - {Inkscape::Filters::CONVOLVEMATRIX_EDGEMODE_NONE, _("None"), "none"} + {Inkscape::Filters::CONVOLVEMATRIX_EDGEMODE_NONE, C_("Convolve matrix, edge mode", "None"), "none"} }; const EnumDataConverter ConvolveMatrixEdgeModeConverter(ConvolveMatrixEdgeModeData, Inkscape::Filters::CONVOLVEMATRIX_EDGEMODE_ENDTYPE); diff --git a/src/live_effects/lpe-ruler.cpp b/src/live_effects/lpe-ruler.cpp index 788ab593a..fd611c78d 100644 --- a/src/live_effects/lpe-ruler.cpp +++ b/src/live_effects/lpe-ruler.cpp @@ -29,7 +29,7 @@ static const Util::EnumData MarkDirData[] = { static const Util::EnumDataConverter MarkDirTypeConverter(MarkDirData, sizeof(MarkDirData)/sizeof(*MarkDirData)); static const Util::EnumData BorderMarkData[] = { - {BORDERMARK_NONE , N_("None"), "none"}, + {BORDERMARK_NONE , NC_("Border mark", "None"), "none"}, {BORDERMARK_START , N_("Start"), "start"}, {BORDERMARK_END , N_("End"), "end"}, {BORDERMARK_BOTH , N_("Both"), "both"}, diff --git a/src/ui/dialog/filter-effects-dialog.cpp b/src/ui/dialog/filter-effects-dialog.cpp index c2367c2a2..bd44846a3 100644 --- a/src/ui/dialog/filter-effects-dialog.cpp +++ b/src/ui/dialog/filter-effects-dialog.cpp @@ -546,7 +546,7 @@ public: _matrix(SP_ATTR_VALUES, _("This matrix determines a linear transform on color space. Each line affects one of the color components. Each column determines how much of each color component from the input is passed to the output. The last column does not depend on input colors, so can be used to adjust a constant component value.")), _saturation("", 0, 0, 1, 0.1, 0.01, 2, SP_ATTR_VALUES), _angle("", 0, 0, 360, 0.1, 0.01, 1, SP_ATTR_VALUES), - _label(_("None"), Gtk::ALIGN_START), + _label(C_("Label", "None"), Gtk::ALIGN_START), _use_stored(false), _saturation_store(0), _angle_store(0) diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index 8d43358a7..c2da12058 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -331,7 +331,7 @@ void InkscapePreferences::initPageTools() _page_selector.add_line( true, "", _t_sel_trans_outl, "", _("Show only a box outline of the objects when moving or transforming")); _page_selector.add_group_header( _("Per-object selection cue")); - _t_sel_cue_none.init ( _("None"), "/options/selcue/value", Inkscape::SelCue::NONE, false, 0); + _t_sel_cue_none.init ( C_("Selection cue", "None"), "/options/selcue/value", Inkscape::SelCue::NONE, false, 0); _page_selector.add_line( true, "", _t_sel_cue_none, "", _("No per-object selection indication")); _t_sel_cue_mark.init ( _("Mark"), "/options/selcue/value", Inkscape::SelCue::MARK, true, &_t_sel_cue_none); @@ -642,7 +642,7 @@ void InkscapePreferences::initPageUI() _win_save_viewport.init ( _("Save and restore documents viewport"), "/options/savedocviewport/value", true); _win_zoom_resize.init ( _("Zoom when window is resized"), "/options/stickyzoom/value", false); _win_show_close.init ( _("Show close button on dialogs"), "/dialogs/showclose", false); - _win_ontop_none.init ( _("None"), "/options/transientpolicy/value", 0, false, 0); + _win_ontop_none.init ( C_("Dialog on top", "None"), "/options/transientpolicy/value", 0, false, 0); _win_ontop_normal.init ( _("Normal"), "/options/transientpolicy/value", 1, true, &_win_ontop_none); _win_ontop_agressive.init ( _("Aggressive"), "/options/transientpolicy/value", 2, false, &_win_ontop_none); @@ -1260,7 +1260,7 @@ void InkscapePreferences::initPageBehavior() _page_steps.add_line( false, "", _steps_compass, "", _("When on, angles are displayed with 0 at north, 0 to 360 range, positive clockwise; otherwise with 0 at east, -180 to 180 range, positive counterclockwise")); int const num_items = 17; - Glib::ustring labels[num_items] = {"90", "60", "45", "36", "30", "22.5", "18", "15", "12", "10", "7.5", "6", "3", "2", "1", "0.5", _("None")}; + Glib::ustring labels[num_items] = {"90", "60", "45", "36", "30", "22.5", "18", "15", "12", "10", "7.5", "6", "3", "2", "1", "0.5", C_("Rotation angle", "None")}; int values[num_items] = {2, 3, 4, 5, 6, 8, 10, 12, 15, 18, 24, 30, 60, 90, 180, 360, 0}; _steps_rot_snap.set_size_request(_sb_width); _steps_rot_snap.init("/options/rotationsnapsperpi/value", labels, values, num_items, 12); @@ -1836,7 +1836,7 @@ void InkscapePreferences::initPageSpellcheck() AspellDictInfoEnumeration *dels = aspell_dict_info_list_elements(dlist); - languages.push_back(Glib::ustring(_("None"))); + languages.push_back(Glib::ustring(C_("Spellchecker language", "None"))); langValues.push_back(Glib::ustring("")); const AspellDictInfo *entry; diff --git a/src/ui/dialog/input.cpp b/src/ui/dialog/input.cpp index 4be6716a5..8343cd6fe 100644 --- a/src/ui/dialog/input.cpp +++ b/src/ui/dialog/input.cpp @@ -1622,7 +1622,7 @@ void InputDialogImpl::ConfPanel::setAxis(gint count) if (barNum < count) { row[axisColumns.value] = Glib::ustring::format(barNum+1); } else { - row[axisColumns.value] = _("None"); + row[axisColumns.value] = C_("Input device axe", "None"); } } diff --git a/src/ui/widget/selected-style.cpp b/src/ui/widget/selected-style.cpp index 042a6614e..f01366e19 100644 --- a/src/ui/widget/selected-style.cpp +++ b/src/ui/widget/selected-style.cpp @@ -179,7 +179,11 @@ SelectedStyle::SelectedStyle(bool /*layout*/) _na[i].show_all(); __na[i] = (_("Nothing selected")); - _none[i].set_markup (C_("Fill and stroke", "None")); + if (i == SS_FILL) { + _none[i].set_markup (C_("Fill", "None")); + } else { + _none[i].set_markup (C_("Stroke", "None")); + } sp_set_font_size_smaller (GTK_WIDGET(_none[i].gobj())); _none[i].show_all(); __none[i] = (i == SS_FILL)? (C_("Fill and stroke", "No fill")) : (C_("Fill and stroke", "No stroke")); diff --git a/src/verbs.cpp b/src/verbs.cpp index ab0fc8d71..4f2783866 100644 --- a/src/verbs.cpp +++ b/src/verbs.cpp @@ -2346,7 +2346,7 @@ void LockAndHideVerb::perform(SPAction *action, void *data) Verb *Verb::_base_verbs[] = { // Header new Verb(SP_VERB_INVALID, NULL, NULL, NULL, NULL, NULL), - new Verb(SP_VERB_NONE, "None", N_("None"), N_("Does nothing"), NULL, NULL), + new Verb(SP_VERB_NONE, "None", NC_("Verb", "None"), N_("Does nothing"), NULL, NULL), // File new FileVerb(SP_VERB_FILE_NEW, "FileNew", N_("Default"), N_("Create new document from the default template"), diff --git a/src/widgets/gradient-toolbar.cpp b/src/widgets/gradient-toolbar.cpp index f5a99f3e7..9cd742fb4 100644 --- a/src/widgets/gradient-toolbar.cpp +++ b/src/widgets/gradient-toolbar.cpp @@ -1109,7 +1109,7 @@ void sp_gradient_toolbox_prep(SPDesktop * desktop, GtkActionGroup* mainActions, GtkTreeIter iter; gtk_list_store_append( model, &iter ); - gtk_list_store_set( model, &iter, 0, _("None"), 1, SP_GRADIENT_SPREAD_PAD, -1 ); + gtk_list_store_set( model, &iter, 0, C_("Gradient repeat type", "None"), 1, SP_GRADIENT_SPREAD_PAD, -1 ); gtk_list_store_append( model, &iter ); gtk_list_store_set( model, &iter, 0, _("Reflected"), 1, SP_GRADIENT_SPREAD_REFLECT, -1 ); diff --git a/src/widgets/pencil-toolbar.cpp b/src/widgets/pencil-toolbar.cpp index 682de8594..45a552889 100644 --- a/src/widgets/pencil-toolbar.cpp +++ b/src/widgets/pencil-toolbar.cpp @@ -152,7 +152,7 @@ static void freehand_change_shape(EgeSelectOneAction* act, GObject *dataKludge) static GList * freehand_shape_dropdown_items_list() { GList *glist = NULL; - glist = g_list_append (glist, _("None")); + glist = g_list_append (glist, const_cast(C_("Freehand shape", "None"))); glist = g_list_append (glist, _("Triangle in")); glist = g_list_append (glist, _("Triangle out")); glist = g_list_append (glist, _("Ellipse")); diff --git a/src/widgets/stroke-marker-selector.cpp b/src/widgets/stroke-marker-selector.cpp index 00b6b5c91..a0121b799 100644 --- a/src/widgets/stroke-marker-selector.cpp +++ b/src/widgets/stroke-marker-selector.cpp @@ -385,7 +385,7 @@ void MarkerComboBox::add_markers (GSList *marker_list, SPDocument *source, gbool if (history) { // add "None" Gtk::TreeModel::Row row = *(marker_store->prepend()); - row[marker_columns.label] = _("None"); + row[marker_columns.label] = C_("Marker", "None"); row[marker_columns.stock] = false; row[marker_columns.marker] = g_strdup("None"); row[marker_columns.image] = NULL; -- cgit v1.2.3 From 65915368e41196b54e18d707320422b185f47d6b Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Thu, 2 Oct 2014 14:46:09 +0200 Subject: Work-around for Pango 1.36.7 which introduced 'Semi-Light' font weight, bug #1364937. (bzr r13577) --- src/libnrtype/FontFactory.cpp | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'src') diff --git a/src/libnrtype/FontFactory.cpp b/src/libnrtype/FontFactory.cpp index fa452dd77..e11fed20c 100644 --- a/src/libnrtype/FontFactory.cpp +++ b/src/libnrtype/FontFactory.cpp @@ -97,6 +97,7 @@ font_factory::font_factory(void) : fontSize(512), loadedPtr(new FaceMapType()) { + // std::cout << pango_version_string() << std::endl; #ifdef USE_PANGO_WIN32 #else pango_ft2_font_map_set_resolution(PANGO_FT2_FONT_MAP(fontServer), @@ -545,6 +546,7 @@ void font_factory::GetUIFamiliesAndStyles(FamilyToStylesMap *map) if (faceDescr) { Glib::ustring familyUIName = GetUIFamilyString(faceDescr); Glib::ustring styleUIName = GetUIStyleString(faceDescr); + // std::cout << familyUIName << " " << styleUIName << " (" << displayName << ")" << std::endl; // Disable synthesized (faux) font faces except for CSS generic faces if (pango_font_face_is_synthesized(faces[currentFace]) ) { @@ -558,6 +560,35 @@ void font_factory::GetUIFamiliesAndStyles(FamilyToStylesMap *map) } } + // Pango breaks the 1 to 1 mapping between Pango weights and CSS weights by + // adding Semi-Light (as of 1.36.7), Book (as of 1.24), and Ultra-Heavy (as of + // 1.24). We need to map these weights to CSS weights. Book and Ultra-Heavy + // are rarely used. Semi-Light (350) is problematic as it is halfway between + // Light (300) and Normal (400) and if care is not taken it is converted to + // Normal, rather than Light. + // + // Note: The ultimate solution to handling various weight in the same + // font family is to support the @font rules from CSS. + // + // Additional notes, helpful for debugging: + // Pango's FC backend: + // Weights defined in fontconfig/fontconfig.h + // String equivalents in src/fcfreetype.c + // Weight set from os2->usWeightClass + // Use Fontforge: Element->Font Info...->OS/2->Misc->Weight Class to check font weight + size_t f = styleUIName.find( "Book" ); + if( f != Glib::ustring::npos ) { + styleUIName.replace( f, 4, "Normal" ); + } + f = styleUIName.find( "Semi-Light" ); + if( f != Glib::ustring::npos ) { + styleUIName.replace( f, 10, "Light" ); + } + f = styleUIName.find( "Ultra-Heavy" ); + if( f != Glib::ustring::npos ) { + styleUIName.replace( f, 11, "Heavy" ); + } + if (!familyUIName.empty() && !styleUIName.empty()) { // Find the right place to put the style information, adding @@ -581,6 +612,7 @@ void font_factory::GetUIFamiliesAndStyles(FamilyToStylesMap *map) ++it) { if ( (*it).CssName == styleUIName) { exists = true; + std::cerr << "Warning: Font face with same CSS values already added: " << familyUIName << " " << styleUIName << " (" << (*it).DisplayName << ", " << displayName << ")" << std::endl; break; } } -- cgit v1.2.3