From de6d47ed290e02aa4bdc64d6cea5a6c8c20e61c7 Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Mon, 23 Oct 2017 00:10:41 +0200 Subject: Fix compilation on Ubuntu Trusty pango_fc_font_map_get_config() is available since pango 1.38 but trusty only has pango 1.36. While calling this function is the "proper" way to get the FcConfig attached to the FontFactory's font map, FcConfigAppFontAddDir() reference says "If config is NULL, the current configuration is used." and it seems to the current configuration is suitable to use in this case (which might change if we ever start to use multiple font maps with different FcConfig's attached but should be fine for now...) --- src/libnrtype/FontFactory.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/libnrtype/FontFactory.cpp b/src/libnrtype/FontFactory.cpp index 677b8abe7..95537734d 100644 --- a/src/libnrtype/FontFactory.cpp +++ b/src/libnrtype/FontFactory.cpp @@ -934,7 +934,10 @@ void font_factory::AddFontsDir(char const *utf8dir) dir = g_filename_from_utf8(utf8dir, -1, NULL, NULL, NULL); # endif - FcConfig *conf = pango_fc_font_map_get_config(PANGO_FC_FONT_MAP(fontServer)); + FcConfig *conf = NULL; +# if PANGO_VERSION_CHECK(1,38,0) + pango_fc_font_map_get_config(PANGO_FC_FONT_MAP(fontServer)); +# endif FcBool res = FcConfigAppFontAddDir(conf, (FcChar8 const *)dir); if (res = FcTrue) { g_info("Fonts dir '%s' added successfully.", utf8dir); -- cgit v1.2.3 From 68d1c505514fe4024c72df86d60a57bcb2b827c8 Mon Sep 17 00:00:00 2001 From: Antonio Ospite Date: Sun, 22 Oct 2017 19:10:24 +0200 Subject: Fix regression after r14761: handle size of selected nodes too big and sticky In r14761 a bug was introduced in ControlManagerImpl::setSelected(), the fixed value _resize was used to set the final value of targetSize for the node instead of item->ctrlResize which is decided conditionally depending on the node state. https://bugs.launchpad.net/inkscape/+bug/1568644 --- src/ui/control-manager.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ui/control-manager.cpp b/src/ui/control-manager.cpp index d0285e467..d0106bfcd 100644 --- a/src/ui/control-manager.cpp +++ b/src/ui/control-manager.cpp @@ -330,10 +330,12 @@ void ControlManagerImpl::setSelected(SPCanvasItem *item, bool selected) if (selected && _resizeOnSelect.count(item->ctrlType)) { item->ctrlResize = 2; + } else { + item->ctrlResize = 0; } // TODO refresh colors - double targetSize = _sizeTable[item->ctrlType][_size - 1] + _resize; + double targetSize = _sizeTable[item->ctrlType][_size - 1] + item->ctrlResize; g_object_set(item, "size", targetSize, NULL); } } -- cgit v1.2.3 From 7d6099e1503637df0505a2459b57b34dc291ad97 Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Mon, 23 Oct 2017 14:55:39 +0200 Subject: Save decl list for 'font-face' rule. Micro-step in supporting rule. --- src/sp-style-elem.cpp | 67 ++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 48 insertions(+), 19 deletions(-) (limited to 'src') diff --git a/src/sp-style-elem.cpp b/src/sp-style-elem.cpp index 1a3c194b9..2deaccad0 100644 --- a/src/sp-style-elem.cpp +++ b/src/sp-style-elem.cpp @@ -281,8 +281,10 @@ start_font_face_cb(CRDocHandler *a_handler, static_cast(parse_tmp.currStmt), unsigned(parse_tmp.stmtType)); // fixme: Check whether we need to unref currStmt if non-NULL. } + CRStatement *font_face_rule = cr_statement_new_at_font_face_rule (parse_tmp.stylesheet, NULL); + g_return_if_fail(font_face_rule && font_face_rule->type == AT_FONT_FACE_RULE_STMT); parse_tmp.stmtType = FONT_FACE_STMT; - parse_tmp.currStmt = NULL; + parse_tmp.currStmt = font_face_rule; } static void @@ -291,12 +293,26 @@ end_font_face_cb(CRDocHandler *a_handler) g_return_if_fail(a_handler->app_data != NULL); ParseTmp &parse_tmp = *static_cast(a_handler->app_data); g_return_if_fail(parse_tmp.hasMagic()); - if (parse_tmp.stmtType != FONT_FACE_STMT || parse_tmp.currStmt != NULL) { - g_warning("Expecting currStmt==NULL and stmtType==1 (FONT_FACE_STMT) at end of @font-face, but found currStmt=%p, stmtType=%u", - static_cast(parse_tmp.currStmt), unsigned(parse_tmp.stmtType)); - // fixme: Check whether we need to unref currStmt if non-NULL. - parse_tmp.currStmt = NULL; + + CRStatement *const font_face_rule = parse_tmp.currStmt; + if (parse_tmp.stmtType == FONT_FACE_STMT + && font_face_rule + && font_face_rule->type == AT_FONT_FACE_RULE_STMT) + { + parse_tmp.stylesheet->statements = cr_statement_append(parse_tmp.stylesheet->statements, + font_face_rule); + } else { + g_warning("Found stmtType=%u, stmt=%p, stmt.type=%u.", + unsigned(parse_tmp.stmtType), + font_face_rule, + unsigned(font_face_rule->type)); } + + std::cout << "end_font_face_cb: font face rule unsupported." << std::endl; + cr_declaration_dump (font_face_rule->kind.font_face_rule->decl_list, stdout, 2, TRUE); + printf ("\n"); + + parse_tmp.currStmt = NULL; parse_tmp.stmtType = NO_STMT; } @@ -305,26 +321,38 @@ property_cb(CRDocHandler *const a_handler, CRString *const a_name, CRTerm *const a_value, gboolean const a_important) { + // std::cout << "property_cb: Entrance: " << a_name->stryng->str << ": " << cr_term_to_string(a_value) << std::endl; g_return_if_fail(a_handler && a_name); g_return_if_fail(a_handler->app_data != NULL); ParseTmp &parse_tmp = *static_cast(a_handler->app_data); g_return_if_fail(parse_tmp.hasMagic()); - if (parse_tmp.stmtType == FONT_FACE_STMT) { - if (parse_tmp.currStmt != NULL) { - g_warning("Found non-NULL currStmt %p though stmtType==FONT_FACE_STMT.", parse_tmp.currStmt); - } - /* We currently ignore @font-face descriptors. */ - return; - } + CRStatement *const ruleset = parse_tmp.currStmt; - g_return_if_fail(ruleset - && ruleset->type == RULESET_STMT - && parse_tmp.stmtType == NORMAL_RULESET_STMT); - CRDeclaration *const decl = cr_declaration_new(ruleset, cr_string_dup(a_name), a_value); + g_return_if_fail(ruleset); + + CRDeclaration *const decl = cr_declaration_new (ruleset, cr_string_dup(a_name), a_value); g_return_if_fail(decl); decl->important = a_important; - CRStatus const append_status = cr_statement_ruleset_append_decl(ruleset, decl); - g_return_if_fail(append_status == CR_OK); + + switch (parse_tmp.stmtType) { + + case NORMAL_RULESET_STMT: { + g_return_if_fail (ruleset->type == RULESET_STMT); + CRStatus const append_status = cr_statement_ruleset_append_decl (ruleset, decl); + g_return_if_fail (append_status == CR_OK); + break; + } + case FONT_FACE_STMT: { + g_return_if_fail (ruleset->type == AT_FONT_FACE_RULE_STMT); + CRDeclaration *new_decls = cr_declaration_append (ruleset->kind.font_face_rule->decl_list, decl); + g_return_if_fail (new_decls); + ruleset->kind.font_face_rule->decl_list = new_decls; + break; + } + default: + g_warning ("property_cb: Unhandled stmtType: %u", parse_tmp.stmtType); + return; + } } CRParser* @@ -405,6 +433,7 @@ void SPStyleElem::read_content() { // If style sheet has changed, we need to cascade the entire object tree, top down // Get root, read style, loop through children update_style_recursively( (SPObject *)document->getRoot() ); + // cr_stylesheet_dump (document->style_sheet, stdout); } /** -- cgit v1.2.3 From d9c86888f170593390da648af3ba444acd177d54 Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Tue, 24 Oct 2017 13:48:52 +0200 Subject: Give drawing a reasonable(?) default size if dimensions are in % and there is no view box. This prevents a GTK3 crash in file preview (#1611672). --- src/sp-root.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/sp-root.cpp b/src/sp-root.cpp index 9ea1aa976..3f31588cc 100644 --- a/src/sp-root.cpp +++ b/src/sp-root.cpp @@ -245,12 +245,12 @@ void SPRoot::setRootDimensions() } else { - if( !this->width._set ) { - this->width.set( SVGLength::PX, 100, 100 ); // Random default + if( !this->width._set || this->width.unit == SVGLength::PERCENT) { + this->width.set( SVGLength::PX, 300, 300 ); // CSS/SVG default } - if( !this->height._set ) { - this->height.set( SVGLength::PX, 100, 100 ); // Random default + if( !this->height._set || this->height.unit == SVGLength::PERCENT) { + this->height.set( SVGLength::PX, 150, 150 ); // CSS/SVG default } } -- cgit v1.2.3