View | Details | Raw Unified | Return to issue 113301
Collapse All | Expand All

(-)a/vcl/source/glyphs/graphite_layout.cxx (-11 / +56 lines)
Lines 594-614 Link Here
594
{
594
{
595
#ifdef GRCACHE
595
#ifdef GRCACHE
596
    GrSegRecord * pSegRecord = NULL;
596
    GrSegRecord * pSegRecord = NULL;
597
    gr::Segment * pSegment = CreateSegment(rArgs, &pSegRecord);
597
    gr::Segment * pSegment = NULL;
598
    if (!pSegment)
598
    // Graphite can in rare cases crash with a zero length
599
       return false;
599
    if (rArgs.mnMinCharPos < rArgs.mnEndCharPos)
600
600
    {
601
        pSegment = CreateSegment(rArgs, &pSegRecord);
602
        if (!pSegment)
603
            return false;
604
    }
605
    else
606
    {
607
        clear();
608
        return true;
609
    }
601
    // layout the glyphs as required by OpenOffice
610
    // layout the glyphs as required by OpenOffice
602
    bool success = LayoutGlyphs(rArgs, pSegment, pSegRecord);
611
    bool success = LayoutGlyphs(rArgs, pSegment, pSegRecord);
603
612
604
    if (pSegRecord) pSegRecord->unlock();
613
    if (pSegRecord) pSegRecord->unlock();
605
    else delete pSegment;
614
    else delete pSegment;
606
#else
615
#else
607
    gr::Segment * pSegment = CreateSegment(rArgs);
616
    gr::Segment * pSegment = NULL;
608
    if (!pSegment)
617
    bool success = true;
609
        return false;
618
    if (rArgs.mnMinCharPos < rArgs.mnEndCharPos)
610
    bool success = LayoutGlyphs(rArgs, pSegment);
619
    {
611
    delete pSegment;
620
        pSegment = CreateSegment(rArgs);
621
        if (!pSegment)
622
            return false;
623
        success = LayoutGlyphs(rArgs, pSegment);
624
        if (pSegment) delete pSegment;
625
    }
626
    else
627
    {
628
        clear();
629
    }
612
#endif
630
#endif
613
    return success;
631
    return success;
614
}
632
}
Lines 722-728 Link Here
722
            (GraphiteCacheHandler::instance).getCache(aFontHash);
740
            (GraphiteCacheHandler::instance).getCache(aFontHash);
723
        if (pCache)
741
        if (pCache)
724
        {
742
        {
725
            *pSegRecord = pCache->getSegment(rArgs, bRtl, nSegCharLimit);
743
            *pSegRecord = pCache->getSegment(rArgs, bRtl, limit);
726
            if (*pSegRecord)
744
            if (*pSegRecord)
727
            {
745
            {
728
                pSegment = (*pSegRecord)->getSegment();
746
                pSegment = (*pSegRecord)->getSegment();
Lines 736-742 Link Here
736
                    (*pSegRecord)->clearVectors();
754
                    (*pSegRecord)->clearVectors();
737
                }
755
                }
738
                mpTextSrc->switchLayoutArgs(rArgs);
756
                mpTextSrc->switchLayoutArgs(rArgs);
739
                return pSegment;
757
                if (limit > rArgs.mnMinCharPos && limit == rArgs.mnEndCharPos
758
                    && pSegment->stopCharacter() != limit)
759
                {
760
                    // check that the last character is not part of a ligature
761
                    glyph_set_range_t aGlyphSet = pSegment->charToGlyphs(limit - 1);
762
                    if (aGlyphSet.first == aGlyphSet.second)
763
                    {
764
                        // no glyphs associated with this glyph - occurs mid ligature
765
                        pSegment = NULL;
766
                        *pSegRecord = NULL;
767
                    }
768
                    else
769
                    {
770
                        while (aGlyphSet.first != aGlyphSet.second)
771
                        {
772
                            int lastChar = static_cast<int>((*aGlyphSet.first).lastChar());
773
                            if (lastChar >= limit)
774
                            {
775
                                pSegment = NULL;
776
                                *pSegRecord = NULL;
777
                                break;
778
                            }
779
                            aGlyphSet.first++;
780
                        }
781
                    }
782
                }
783
                if (pSegment)
784
                    return pSegment;
740
            }
785
            }
741
        }
786
        }
742
#endif
787
#endif
(-)a/vcl/win/source/gdi/winlayout.cxx (+5 lines)
Lines 2894-2899 Link Here
2894
2894
2895
bool GraphiteWinLayout::LayoutText( ImplLayoutArgs & args)
2895
bool GraphiteWinLayout::LayoutText( ImplLayoutArgs & args)
2896
{
2896
{
2897
    if (args.mnMinCharPos >= args.mnEndCharPos)
2898
    {
2899
        maImpl.clear();
2900
        return true;
2901
    }
2897
    HFONT hUnRotatedFont;
2902
    HFONT hUnRotatedFont;
2898
    if (args.mnOrientation)
2903
    if (args.mnOrientation)
2899
    {
2904
    {

Return to issue 113301