~valavanisalex/ubuntu/oneiric/inkscape/inkscape_0.48.1-2ubuntu4

« back to all changes in this revision

Viewing changes to src/libnrtype/Layout-TNG-Compute.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Kees Cook, Ted Gould, Kees Cook
  • Date: 2009-06-24 14:00:43 UTC
  • mfrom: (1.1.8 upstream)
  • Revision ID: james.westby@ubuntu.com-20090624140043-07stp20mry48hqup
Tags: 0.47~pre0-0ubuntu1
* New upstream release

[ Ted Gould ]
* debian/control: Adding libgsl0 and removing version specifics on boost

[ Kees Cook ]
* debian/watch: updated to run uupdate and mangle pre-release versions.
* Dropped patches that have been taken upstream:
  - 01_mips
  - 02-poppler-0.8.3
  - 03-chinese-inkscape
  - 05_fix_latex_patch
  - 06_gcc-4.4
  - 07_cdr2svg
  - 08_skip-bad-utf-on-pdf-import
  - 09_gtk-clist
  - 10_belarussian
  - 11_libpng
  - 12_desktop
  - 13_slider
  - 100_svg_import_improvements
  - 102_sp_pattern_painter_free
  - 103_bitmap_type_print

Show diffs side-by-side

added added

removed removed

Lines of Context:
475
475
                new_span.in_input_stream_item = unbroken_span.input_index;
476
476
                new_span.baseline_shift = _y_offset;
477
477
                new_span.block_progression = _block_progression;
478
 
                if (_flow._input_stream[unbroken_span.input_index]->Type() == TEXT_SOURCE) {
479
 
                    new_span.font = para.pango_items[unbroken_span.pango_item_index].font;
480
 
                    new_span.font->Ref();
 
478
                if ((_flow._input_stream[unbroken_span.input_index]->Type() == TEXT_SOURCE) && (new_span.font = para.pango_items[unbroken_span.pango_item_index].font))
 
479
                    {
 
480
                    new_span.font->Ref();
481
481
                    new_span.font_size = unbroken_span.font_size;
482
482
                    new_span.direction = para.pango_items[unbroken_span.pango_item_index].item->analysis.level & 1 ? RIGHT_TO_LEFT : LEFT_TO_RIGHT;
483
483
                    new_span.input_stream_first_character = Glib::ustring::const_iterator(unbroken_span.input_stream_first_character.base() + it_span->start.char_byte);
562
562
                            new_glyph.x = x + unbroken_span.glyph_string->glyphs[glyph_index].geometry.x_offset * font_size_multiplier;
563
563
                            new_glyph.y = _y_offset + unbroken_span.glyph_string->glyphs[glyph_index].geometry.y_offset * font_size_multiplier;
564
564
                            new_glyph.width = unbroken_span.glyph_string->glyphs[glyph_index].geometry.width * font_size_multiplier;
565
 
                            if (new_glyph.width == 0)
 
565
                            if ((new_glyph.width == 0) && (para.pango_items[unbroken_span.pango_item_index].font))
566
566
                                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);
567
567
                                // for some reason pango returns zero width for invalid glyph characters (those empty boxes), so go to freetype for the info
568
568
                        }
615
615
                            iter_source_text++;
616
616
                            char_index_in_unbroken_span++;
617
617
                            char_byte = iter_source_text.base() - unbroken_span.input_stream_first_character.base();
618
 
                            glyph_rotate = 0.0;
619
618
                        }
620
619
 
621
620
                        advance_width *= direction_sign;
903
902
        line_height->setZero();
904
903
        *line_height_multiplier = 1.0;
905
904
    }
906
 
    font->FontMetrics(line_height->ascent, line_height->descent, line_height->leading);
 
905
    else
 
906
        font->FontMetrics(line_height->ascent, line_height->descent, line_height->leading);
907
907
    *line_height *= font_size;
908
908
 
909
909
    // yet another borked SPStyle member that we're going to have to fix ourselves
1013
1013
                    if (text_source->dy.size() > char_index_in_source) new_span.dx = text_source->dy[char_index_in_source];
1014
1014
                }
1015
1015
                if (text_source->rotate.size() > char_index_in_source) new_span.rotate = text_source->rotate[char_index_in_source];
 
1016
                else if (char_index_in_source == 0) new_span.rotate = 0.f;
1016
1017
                if (input_index == 0 && para->unbroken_spans.empty() && !new_span.y._set && _flow._input_wrap_shapes.empty()) {
1017
1018
                    // if we don't set an explicit y some of the automatic wrapping code takes over and moves the text vertically
1018
1019
                    // so that the top of the letters is at zero, not the baseline
1344
1345
{
1345
1346
    if (_flow._input_stream.empty())
1346
1347
        return false;
1347
 
    g_assert(_flow._input_stream.front()->Type() == TEXT_SOURCE);
 
1348
    /**
 
1349
    * hm, why do we want assert (crash) the application, now do simply return false
 
1350
    * \todo check if this is the correct behaviour
 
1351
    * g_assert(_flow._input_stream.front()->Type() == TEXT_SOURCE);
 
1352
    */
1348
1353
    if (_flow._input_stream.front()->Type() != TEXT_SOURCE)
 
1354
    {
 
1355
        g_warning("flow text is not of type TEXT_SOURCE. Abort.");
1349
1356
        return false;
1350
 
 
 
1357
    }
1351
1358
    TRACE(("begin calculateFlow()\n"));
1352
1359
 
1353
1360
    _flow._clearOutputObjects();
1468
1475
 
1469
1476
void Layout::_calculateCursorShapeForEmpty()
1470
1477
{
1471
 
    _empty_cursor_shape.position = NR::Point(0, 0);
 
1478
    _empty_cursor_shape.position = Geom::Point(0, 0);
1472
1479
    _empty_cursor_shape.height = 0.0;
1473
1480
    _empty_cursor_shape.rotation = 0.0;
1474
1481
    if (_input_stream.empty() || _input_stream.front()->Type() != TEXT_SOURCE)
1495
1502
    _empty_cursor_shape.rotation = caret_slope;
1496
1503
 
1497
1504
    if (_input_wrap_shapes.empty()) {
1498
 
        _empty_cursor_shape.position = NR::Point(text_source->x.empty() || !text_source->x.front()._set ? 0.0 : text_source->x.front().computed,
 
1505
        _empty_cursor_shape.position = Geom::Point(text_source->x.empty() || !text_source->x.front()._set ? 0.0 : text_source->x.front().computed,
1499
1506
                                                 text_source->y.empty() || !text_source->y.front()._set ? 0.0 : text_source->y.front().computed);
1500
1507
    } else {
1501
1508
        Direction block_progression = text_source->styleGetBlockProgression();
1503
1510
        std::vector<ScanlineMaker::ScanRun> scan_runs = scanline_maker.makeScanline(line_height);
1504
1511
        if (!scan_runs.empty()) {
1505
1512
            if (block_progression == LEFT_TO_RIGHT || block_progression == RIGHT_TO_LEFT)
1506
 
                _empty_cursor_shape.position = NR::Point(scan_runs.front().y + font_size, scan_runs.front().x_start);
 
1513
                _empty_cursor_shape.position = Geom::Point(scan_runs.front().y + font_size, scan_runs.front().x_start);
1507
1514
            else
1508
 
                _empty_cursor_shape.position = NR::Point(scan_runs.front().x_start, scan_runs.front().y + font_size);
 
1515
                _empty_cursor_shape.position = Geom::Point(scan_runs.front().x_start, scan_runs.front().y + font_size);
1509
1516
        }
1510
1517
    }
1511
1518
}