#! /bin/sh /usr/share/dpatch/dpatch-run ## 03-upstream-fix-for-zh_CN-locale-crash.dpatch by Thomas Viehmann ## ## All lines beginning with `## DP:' are a description of the patch. ## DP: This patch is taken from upstream to fix a crash in the file ## DP: open dialogue for the zh_CN.utf8 locale. ## DP: (closes: #487623) @DPATCH@ diff -urN inkscape-0.46~/src/libnrtype/FontFactory.cpp inkscape-0.46/src/libnrtype/FontFactory.cpp --- inkscape-0.46~/src/libnrtype/FontFactory.cpp 2008-03-11 05:20:29.000000000 +0100 +++ ./src/libnrtype/FontFactory.cpp 2008-09-09 23:23:01.000000000 +0200 @@ -817,7 +817,8 @@ res->Ref(); AddInCache(res); } - res->InitTheFace(); + if(res) + res->InitTheFace(); return res; } diff -urN inkscape-0.46~/src/libnrtype/Layout-TNG-Compute.cpp inkscape-0.46/src/libnrtype/Layout-TNG-Compute.cpp --- inkscape-0.46~/src/libnrtype/Layout-TNG-Compute.cpp 2008-03-11 05:20:29.000000000 +0100 +++ ./src/libnrtype/Layout-TNG-Compute.cpp 2008-09-09 23:23:01.000000000 +0200 @@ -475,9 +475,9 @@ new_span.in_input_stream_item = unbroken_span.input_index; new_span.baseline_shift = _y_offset; new_span.block_progression = _block_progression; - if (_flow._input_stream[unbroken_span.input_index]->Type() == TEXT_SOURCE) { - new_span.font = para.pango_items[unbroken_span.pango_item_index].font; - new_span.font->Ref(); + if ((_flow._input_stream[unbroken_span.input_index]->Type() == TEXT_SOURCE) && (new_span.font = para.pango_items[unbroken_span.pango_item_index].font)) + { + new_span.font->Ref(); new_span.font_size = unbroken_span.font_size; new_span.direction = para.pango_items[unbroken_span.pango_item_index].item->analysis.level & 1 ? RIGHT_TO_LEFT : LEFT_TO_RIGHT; new_span.input_stream_first_character = Glib::ustring::const_iterator(unbroken_span.input_stream_first_character.base() + it_span->start.char_byte); @@ -562,7 +562,7 @@ new_glyph.x = x + unbroken_span.glyph_string->glyphs[glyph_index].geometry.x_offset * font_size_multiplier; new_glyph.y = _y_offset + unbroken_span.glyph_string->glyphs[glyph_index].geometry.y_offset * font_size_multiplier; new_glyph.width = unbroken_span.glyph_string->glyphs[glyph_index].geometry.width * font_size_multiplier; - if (new_glyph.width == 0) + if ((new_glyph.width == 0) && (para.pango_items[unbroken_span.pango_item_index].font)) new_glyph.width = new_span.font_size * para.pango_items[unbroken_span.pango_item_index].font->Advance(unbroken_span.glyph_string->glyphs[glyph_index].glyph, false); // for some reason pango returns zero width for invalid glyph characters (those empty boxes), so go to freetype for the info } @@ -903,7 +903,8 @@ line_height->setZero(); *line_height_multiplier = 1.0; } - font->FontMetrics(line_height->ascent, line_height->descent, line_height->leading); + else + font->FontMetrics(line_height->ascent, line_height->descent, line_height->leading); *line_height *= font_size; // yet another borked SPStyle member that we're going to have to fix ourselves diff -urN inkscape-0.46~/src/libnrtype/Layout-TNG-Output.cpp inkscape-0.46/src/libnrtype/Layout-TNG-Output.cpp --- inkscape-0.46~/src/libnrtype/Layout-TNG-Output.cpp 2008-03-11 05:20:29.000000000 +0100 +++ ./src/libnrtype/Layout-TNG-Output.cpp 2008-09-09 23:23:01.000000000 +0200 @@ -112,22 +112,24 @@ _getGlyphTransformMatrix(glyph_index, &glyph_matrix); NR::Matrix total_transform = glyph_matrix; total_transform *= transform; - NR::Maybe<NR::Rect> glyph_rect = _glyphs[glyph_index].span(this).font->BBox(_glyphs[glyph_index].glyph); - if (glyph_rect) { - NR::Point bmi = glyph_rect->min(), bma = glyph_rect->max(); - NR::Point tlp(bmi[0],bmi[1]), trp(bma[0],bmi[1]), blp(bmi[0],bma[1]), brp(bma[0],bma[1]); - tlp *= total_transform; - trp *= total_transform; - blp *= total_transform; - brp *= total_transform; - *glyph_rect = NR::Rect(tlp,trp); - glyph_rect->expandTo(blp); - glyph_rect->expandTo(brp); - if ( (glyph_rect->min())[0] < bounding_box->x0 ) bounding_box->x0=(glyph_rect->min())[0]; - if ( (glyph_rect->max())[0] > bounding_box->x1 ) bounding_box->x1=(glyph_rect->max())[0]; - if ( (glyph_rect->min())[1] < bounding_box->y0 ) bounding_box->y0=(glyph_rect->min())[1]; - if ( (glyph_rect->max())[1] > bounding_box->y1 ) bounding_box->y1=(glyph_rect->max())[1]; - } + if(_glyphs[glyph_index].span(this).font) { + NR::Maybe<NR::Rect> glyph_rect = _glyphs[glyph_index].span(this).font->BBox(_glyphs[glyph_index].glyph); + if (glyph_rect) { + NR::Point bmi = glyph_rect->min(), bma = glyph_rect->max(); + NR::Point tlp(bmi[0],bmi[1]), trp(bma[0],bmi[1]), blp(bmi[0],bma[1]), brp(bma[0],bma[1]); + tlp *= total_transform; + trp *= total_transform; + blp *= total_transform; + brp *= total_transform; + *glyph_rect = NR::Rect(tlp,trp); + glyph_rect->expandTo(blp); + glyph_rect->expandTo(brp); + if ( (glyph_rect->min())[0] < bounding_box->x0 ) bounding_box->x0=(glyph_rect->min())[0]; + if ( (glyph_rect->max())[0] > bounding_box->x1 ) bounding_box->x1=(glyph_rect->max())[0]; + if ( (glyph_rect->min())[1] < bounding_box->y0 ) bounding_box->y0=(glyph_rect->min())[1]; + if ( (glyph_rect->max())[1] > bounding_box->y1 ) bounding_box->y1=(glyph_rect->max())[1]; + } + } } }