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

(-)a/vcl/inc/vcl/fontmanager.hxx (-2 / +2 lines)
Lines 738-745 Link Here
738
    bool matchFont( FastPrintFontInfo& rInfo, const com::sun::star::lang::Locale& rLocale );
738
    bool matchFont( FastPrintFontInfo& rInfo, const com::sun::star::lang::Locale& rLocale );
739
739
740
    rtl::OUString Substitute( const rtl::OUString& rFontName, rtl::OUString& rMissingCodes, 
740
    rtl::OUString Substitute( const rtl::OUString& rFontName, rtl::OUString& rMissingCodes, 
741
        const rtl::OString& rLangAttrib, italic::type eItalic, weight::type eWeight, 
741
        const rtl::OString& rLangAttrib, italic::type& rItalic, weight::type& rWeight, 
742
        width::type eWidth, pitch::type ePitch) const;
742
        width::type& rWidth, pitch::type& rPitch) const;
743
    bool hasFontconfig() const { return m_bFontconfigSuccess; }
743
    bool hasFontconfig() const { return m_bFontconfigSuccess; }
744
744
745
    int FreeTypeCharIndex( void *pFace, sal_uInt32 aChar );
745
    int FreeTypeCharIndex( void *pFace, sal_uInt32 aChar );
(-)a/vcl/inc/vcl/outfont.hxx (-4 / +6 lines)
Lines 339-353 Link Here
339
    short               mnOrientation;      // text angle in 3600 system
339
    short               mnOrientation;      // text angle in 3600 system
340
    bool                mbInit;             // true if maMetric member is valid
340
    bool                mbInit;             // true if maMetric member is valid
341
341
342
    void                AddFallbackForUnicode( sal_UCS4, const String& rFontName );
342
    void                AddFallbackForUnicode( sal_UCS4, FontWeight eWeight, const String& rFontName );
343
    bool                GetFallbackForUnicode( sal_UCS4, String* pFontName ) const;
343
    bool                GetFallbackForUnicode( sal_UCS4, FontWeight eWeight, String* pFontName ) const;
344
    void                IgnoreFallbackForUnicode( sal_UCS4, const String& rFontName );
344
    void                IgnoreFallbackForUnicode( sal_UCS4, FontWeight eWeight, const String& rFontName );
345
345
346
private:
346
private:
347
    // cache of Unicode characters and replacement font names
347
    // cache of Unicode characters and replacement font names
348
    // TODO: a fallback map can be shared with many other ImplFontEntries
348
    // TODO: a fallback map can be shared with many other ImplFontEntries
349
    // TODO: at least the ones which just differ in orientation, stretching or height
349
    // TODO: at least the ones which just differ in orientation, stretching or height
350
    typedef ::std::hash_map<sal_UCS4,String> UnicodeFallbackList;
350
    typedef ::std::pair<sal_UCS4,FontWeight> CharDescr;
351
    struct CharDescr_Hash{ size_t operator()( const CharDescr& ) const; };
352
    typedef ::std::hash_map<CharDescr,String,CharDescr_Hash> UnicodeFallbackList;
351
    UnicodeFallbackList* mpUnicodeFallbackList;
353
    UnicodeFallbackList* mpUnicodeFallbackList;
352
};
354
};
353
355
(-)a/vcl/source/gdi/outdev3.cxx (-15 / +22 lines)
Lines 995-1015 Link Here
995
995
996
// -----------------------------------------------------------------------
996
// -----------------------------------------------------------------------
997
997
998
inline void ImplFontEntry::AddFallbackForUnicode( sal_UCS4 cChar, const String& rFontName )
998
size_t ImplFontEntry::CharDescr_Hash::operator()( const CharDescr& rData ) const
999
{
1000
    std::hash<sal_UCS4> a;
1001
    std::hash<int > b;
1002
    return a(rData.first) | b(rData.second);
1003
}
1004
1005
inline void ImplFontEntry::AddFallbackForUnicode( sal_UCS4 cChar, FontWeight eWeight, const String& rFontName )
999
{
1006
{
1000
    if( !mpUnicodeFallbackList )
1007
    if( !mpUnicodeFallbackList )
1001
        mpUnicodeFallbackList = new UnicodeFallbackList;
1008
        mpUnicodeFallbackList = new UnicodeFallbackList;
1002
    (*mpUnicodeFallbackList)[cChar] = rFontName;
1009
    (*mpUnicodeFallbackList)[CharDescr(cChar, eWeight)] = rFontName;
1003
}
1010
}
1004
1011
1005
// -----------------------------------------------------------------------
1012
// -----------------------------------------------------------------------
1006
1013
1007
inline bool ImplFontEntry::GetFallbackForUnicode( sal_UCS4 cChar, String* pFontName ) const
1014
inline bool ImplFontEntry::GetFallbackForUnicode( sal_UCS4 cChar, FontWeight eWeight, String* pFontName ) const
1008
{
1015
{
1009
    if( !mpUnicodeFallbackList )
1016
    if( !mpUnicodeFallbackList )
1010
        return false;
1017
        return false;
1011
1018
1012
    UnicodeFallbackList::const_iterator it = mpUnicodeFallbackList->find( cChar );
1019
    UnicodeFallbackList::const_iterator it = mpUnicodeFallbackList->find( CharDescr(cChar, eWeight) );
1013
    if( it == mpUnicodeFallbackList->end() )
1020
    if( it == mpUnicodeFallbackList->end() )
1014
        return false;
1021
        return false;
1015
1022
Lines 1019-1028 Link Here
1019
1026
1020
// -----------------------------------------------------------------------
1027
// -----------------------------------------------------------------------
1021
1028
1022
inline void ImplFontEntry::IgnoreFallbackForUnicode( sal_UCS4 cChar, const String& rFontName )
1029
inline void ImplFontEntry::IgnoreFallbackForUnicode( sal_UCS4 cChar, FontWeight eWeight, const String& rFontName )
1023
{
1030
{
1024
//  DBG_ASSERT( mpUnicodeFallbackList, "ImplFontEntry::IgnoreFallbackForUnicode no list" );
1031
//  DBG_ASSERT( mpUnicodeFallbackList, "ImplFontEntry::IgnoreFallbackForUnicode no list" );
1025
    UnicodeFallbackList::iterator it = mpUnicodeFallbackList->find( cChar );
1032
    UnicodeFallbackList::iterator it = mpUnicodeFallbackList->find( CharDescr(cChar, eWeight) );
1026
//  DBG_ASSERT( it != mpUnicodeFallbackList->end(), "ImplFontEntry::IgnoreFallbackForUnicode no match" );
1033
//  DBG_ASSERT( it != mpUnicodeFallbackList->end(), "ImplFontEntry::IgnoreFallbackForUnicode no match" );
1027
    if( it == mpUnicodeFallbackList->end() )
1034
    if( it == mpUnicodeFallbackList->end() )
1028
        return;
1035
        return;
Lines 1417-1423 Link Here
1417
        while( nStrIndex < rMissingCodes.getLength() )
1424
        while( nStrIndex < rMissingCodes.getLength() )
1418
        {
1425
        {
1419
            cChar = rMissingCodes.iterateCodePoints( &nStrIndex );
1426
            cChar = rMissingCodes.iterateCodePoints( &nStrIndex );
1420
            bCached = rFontSelData.mpFontEntry->GetFallbackForUnicode( cChar, &rFontSelData.maSearchName );
1427
            bCached = rFontSelData.mpFontEntry->GetFallbackForUnicode( cChar, rFontSelData.GetWeight(), &rFontSelData.maSearchName );
1421
            // ignore entries which don't have a fallback
1428
            // ignore entries which don't have a fallback
1422
            if( !bCached || (rFontSelData.maSearchName.Len() != 0) )
1429
            if( !bCached || (rFontSelData.maSearchName.Len() != 0) )
1423
                break;
1430
                break;
Lines 1433-1439 Link Here
1433
            while( nStrIndex < rMissingCodes.getLength() )
1440
            while( nStrIndex < rMissingCodes.getLength() )
1434
            {
1441
            {
1435
                cChar = rMissingCodes.iterateCodePoints( &nStrIndex );
1442
                cChar = rMissingCodes.iterateCodePoints( &nStrIndex );
1436
                bCached = rFontSelData.mpFontEntry->GetFallbackForUnicode( cChar, &aFontName );
1443
                bCached = rFontSelData.mpFontEntry->GetFallbackForUnicode( cChar, rFontSelData.GetWeight(), &aFontName );
1437
                if( !bCached || (rFontSelData.maSearchName != aFontName) )
1444
                if( !bCached || (rFontSelData.maSearchName != aFontName) )
1438
                    pRemainingCodes[ nRemainingLength++ ] = cChar;
1445
                    pRemainingCodes[ nRemainingLength++ ] = cChar;
1439
            }
1446
            }
Lines 1452-1459 Link Here
1452
            // cache the result even if there was no match
1459
            // cache the result even if there was no match
1453
            for(;;)
1460
            for(;;)
1454
            {
1461
            {
1455
                 if( !rFontSelData.mpFontEntry->GetFallbackForUnicode( cChar, &rFontSelData.maSearchName ) )
1462
                 if( !rFontSelData.mpFontEntry->GetFallbackForUnicode( cChar, rFontSelData.GetWeight(), &rFontSelData.maSearchName ) )
1456
                     rFontSelData.mpFontEntry->AddFallbackForUnicode( cChar, rFontSelData.maSearchName );
1463
                     rFontSelData.mpFontEntry->AddFallbackForUnicode( cChar, rFontSelData.GetWeight(), rFontSelData.maSearchName );
1457
                 if( nStrIndex >= aOldMissingCodes.getLength() )
1464
                 if( nStrIndex >= aOldMissingCodes.getLength() )
1458
                     break;
1465
                     break;
1459
                 cChar = aOldMissingCodes.iterateCodePoints( &nStrIndex );
1466
                 cChar = aOldMissingCodes.iterateCodePoints( &nStrIndex );
Lines 1464-1470 Link Here
1464
                for( nStrIndex = 0; nStrIndex < rMissingCodes.getLength(); )
1471
                for( nStrIndex = 0; nStrIndex < rMissingCodes.getLength(); )
1465
                {
1472
                {
1466
                    cChar = rMissingCodes.iterateCodePoints( &nStrIndex );
1473
                    cChar = rMissingCodes.iterateCodePoints( &nStrIndex );
1467
                    rFontSelData.mpFontEntry->IgnoreFallbackForUnicode( cChar, rFontSelData.maSearchName );
1474
                    rFontSelData.mpFontEntry->IgnoreFallbackForUnicode( cChar, rFontSelData.GetWeight(), rFontSelData.maSearchName );
1468
                }
1475
                }
1469
            }
1476
            }
1470
        }
1477
        }
(-)a/vcl/unx/source/fontmanager/fontconfig.cxx (-42 / +83 lines)
Lines 565-570 Link Here
565
    return true;
565
    return true;
566
}
566
}
567
567
568
namespace
569
{
570
    weight::type convertWeight(int weight)
571
    {
572
        // set weight
573
        if( weight <= FC_WEIGHT_THIN )
574
            return weight::Thin;
575
        else if( weight <= FC_WEIGHT_ULTRALIGHT )
576
            return weight::UltraLight;
577
        else if( weight <= FC_WEIGHT_LIGHT )
578
            return weight::Light;
579
        else if( weight <= FC_WEIGHT_BOOK )
580
            return weight::SemiLight;
581
        else if( weight <= FC_WEIGHT_NORMAL )
582
            return weight::Normal;
583
        else if( weight <= FC_WEIGHT_MEDIUM )
584
            return weight::Medium;
585
        else if( weight <= FC_WEIGHT_SEMIBOLD )
586
            return weight::SemiBold;
587
        else if( weight <= FC_WEIGHT_BOLD )
588
            return weight::Bold;
589
        else if( weight <= FC_WEIGHT_ULTRABOLD )
590
            return weight::UltraBold;
591
        return weight::Black;
592
    }
593
594
    italic::type convertSlant(int slant)
595
    {
596
        // set italic
597
        if( slant == FC_SLANT_ITALIC )
598
            return italic::Italic;
599
        else if( slant == FC_SLANT_OBLIQUE )
600
            return italic::Oblique;
601
        return italic::Upright;
602
    }
603
604
    pitch::type convertSpacing(int spacing)
605
    {
606
        // set pitch
607
        if( spacing == FC_MONO || spacing == FC_CHARCELL )
608
            return pitch::Fixed;
609
        return pitch::Variable;
610
    }
611
612
    width::type convertWidth(int width)
613
    {
614
        if (width == FC_WIDTH_ULTRACONDENSED)
615
            return width::UltraCondensed;
616
        else if (width == FC_WIDTH_EXTRACONDENSED)
617
            return width::ExtraCondensed;
618
        else if (width == FC_WIDTH_CONDENSED)
619
            return width::Condensed;
620
        else if (width == FC_WIDTH_SEMICONDENSED)
621
            return width::SemiCondensed;
622
        else if (width == FC_WIDTH_SEMIEXPANDED)
623
            return width::SemiExpanded;
624
        else if (width == FC_WIDTH_EXPANDED)
625
            return width::Expanded;
626
        else if (width == FC_WIDTH_EXTRAEXPANDED)
627
            return width::ExtraExpanded;
628
        else if (width == FC_WIDTH_ULTRAEXPANDED)
629
            return width::UltraExpanded;
630
        return width::Normal;
631
    }
632
}
633
568
int PrintFontManager::countFontconfigFonts()
634
int PrintFontManager::countFontconfigFonts()
569
{
635
{
570
    int nFonts = 0;
636
    int nFonts = 0;
Lines 694-740 Link Here
694
                    pUpdate->m_nFamilyName = nFamilyName;
760
                    pUpdate->m_nFamilyName = nFamilyName;
695
                }
761
                }
696
                if( eWeightRes == FcResultMatch )
762
                if( eWeightRes == FcResultMatch )
697
                {
763
					pUpdate->m_eWeight = convertWeight(weight);
698
                    // set weight
699
                    if( weight <= FC_WEIGHT_THIN )
700
                        pUpdate->m_eWeight = weight::Thin;
701
                    else if( weight <= FC_WEIGHT_ULTRALIGHT )
702
                        pUpdate->m_eWeight = weight::UltraLight;
703
                    else if( weight <= FC_WEIGHT_LIGHT )
704
                        pUpdate->m_eWeight = weight::Light;
705
                    else if( weight <= FC_WEIGHT_BOOK )
706
                        pUpdate->m_eWeight = weight::SemiLight;
707
                    else if( weight <= FC_WEIGHT_NORMAL )
708
                        pUpdate->m_eWeight = weight::Normal;
709
                    else if( weight <= FC_WEIGHT_MEDIUM )
710
                        pUpdate->m_eWeight = weight::Medium;
711
                    else if( weight <= FC_WEIGHT_SEMIBOLD )
712
                        pUpdate->m_eWeight = weight::SemiBold;
713
                    else if( weight <= FC_WEIGHT_BOLD )
714
                        pUpdate->m_eWeight = weight::Bold;
715
                    else if( weight <= FC_WEIGHT_ULTRABOLD )
716
                        pUpdate->m_eWeight = weight::UltraBold;
717
                    else
718
                        pUpdate->m_eWeight = weight::Black;
719
                }
720
                if( eSpacRes == FcResultMatch )
764
                if( eSpacRes == FcResultMatch )
721
                {
765
                    pUpdate->m_ePitch = convertSpacing(spacing);
722
                    // set pitch
723
                    if( spacing == FC_PROPORTIONAL )
724
                        pUpdate->m_ePitch = pitch::Variable;
725
                    else if( spacing == FC_MONO || spacing == FC_CHARCELL )
726
                        pUpdate->m_ePitch = pitch::Fixed;
727
                }
728
                if( eSlantRes == FcResultMatch )
766
                if( eSlantRes == FcResultMatch )
729
                {
767
					pUpdate->m_eItalic = convertSlant(slant);
730
                    // set italic
731
                    if( slant == FC_SLANT_ROMAN )
732
                        pUpdate->m_eItalic = italic::Upright;
733
                    else if( slant == FC_SLANT_ITALIC )
734
                        pUpdate->m_eItalic = italic::Italic;
735
                    else if( slant == FC_SLANT_OBLIQUE )
736
                        pUpdate->m_eItalic = italic::Oblique;
737
                }
738
                if( eStyleRes == FcResultMatch )
768
                if( eStyleRes == FcResultMatch )
739
                {
769
                {
740
                    pUpdate->m_aStyleName = OStringToOUString( OString( (sal_Char*)style ), RTL_TEXTENCODING_UTF8 );
770
                    pUpdate->m_aStyleName = OStringToOUString( OString( (sal_Char*)style ), RTL_TEXTENCODING_UTF8 );
Lines 883-890 Link Here
883
913
884
rtl::OUString PrintFontManager::Substitute(const rtl::OUString& rFontName,
914
rtl::OUString PrintFontManager::Substitute(const rtl::OUString& rFontName,
885
    rtl::OUString& rMissingCodes, const rtl::OString &rLangAttrib,
915
    rtl::OUString& rMissingCodes, const rtl::OString &rLangAttrib,
886
    italic::type eItalic, weight::type eWeight,
916
    italic::type &rItalic, weight::type &rWeight,
887
    width::type eWidth, pitch::type ePitch) const
917
    width::type &rWidth, pitch::type &rPitch) const
888
{
918
{
889
    rtl::OUString aName;
919
    rtl::OUString aName;
890
    FontCfgWrapper& rWrapper = FontCfgWrapper::get();
920
    FontCfgWrapper& rWrapper = FontCfgWrapper::get();
Lines 919-925 Link Here
919
       rWrapper.FcCharSetDestroy( unicodes );
949
       rWrapper.FcCharSetDestroy( unicodes );
920
    }
950
    }
921
951
922
    addtopattern(rWrapper, pPattern, eItalic, eWeight, eWidth, ePitch);
952
    addtopattern(rWrapper, pPattern, rItalic, rWeight, rWidth, rPitch);
923
953
924
    // query fontconfig for a substitute
954
    // query fontconfig for a substitute
925
    rWrapper.FcConfigSubstitute( rWrapper.FcConfigGetCurrent(), pPattern, FcMatchPattern );
955
    rWrapper.FcConfigSubstitute( rWrapper.FcConfigGetCurrent(), pPattern, FcMatchPattern );
Lines 956-961 Link Here
956
                if (aI != rWrapper.m_aFontconfigNameToLocalized.end())
986
                if (aI != rWrapper.m_aFontconfigNameToLocalized.end())
957
                    sFamily = aI->second;
987
                    sFamily = aI->second;
958
                aName = rtl::OStringToOUString( sFamily, RTL_TEXTENCODING_UTF8 );
988
                aName = rtl::OStringToOUString( sFamily, RTL_TEXTENCODING_UTF8 );
989
990
991
                int val = 0;
992
                if ( FcResultMatch == rWrapper.FcPatternGetInteger( pSet->fonts[0], FC_WEIGHT, 0, &val))
993
                    rWeight = convertWeight(val);
994
                if ( FcResultMatch == rWrapper.FcPatternGetInteger( pSet->fonts[0], FC_SLANT, 0, &val))
995
                    rItalic = convertSlant(val);
996
                if ( FcResultMatch == rWrapper.FcPatternGetInteger( pSet->fonts[0], FC_SPACING, 0, &val))
997
                    rPitch = convertSpacing(val);
998
                if ( FcResultMatch == rWrapper.FcPatternGetInteger( pSet->fonts[0], FC_WIDTH, 0, &val))
999
                    rWidth = convertWidth(val);
959
            }
1000
            }
960
1001
961
			// update rMissingCodes by removing resolved unicodes
1002
			// update rMissingCodes by removing resolved unicodes
(-)a/vcl/unx/source/gdi/salgdi3.cxx (-14 / +79 lines)
Lines 1876-1883 Link Here
1876
1876
1877
// -----------------------------------------------------------------------
1877
// -----------------------------------------------------------------------
1878
1878
1879
static rtl::OUString GetFcSubstitute(const ImplFontSelectData &rFontSelData, OUString& rMissingCodes )
1879
static ImplFontSelectData GetFcSubstitute(const ImplFontSelectData &rFontSelData, OUString& rMissingCodes )
1880
{
1880
{
1881
    ImplFontSelectData aRet(rFontSelData);
1882
1881
    const rtl::OString aLangAttrib; //TODO: = MsLangId::convertLanguageToIsoByteString( rFontSelData.meLanguage );
1883
    const rtl::OString aLangAttrib; //TODO: = MsLangId::convertLanguageToIsoByteString( rFontSelData.meLanguage );
1882
1884
1883
    psp::italic::type eItalic = psp::italic::Unknown;
1885
    psp::italic::type eItalic = psp::italic::Unknown;
Lines 1945-1951 Link Here
1945
    }
1947
    }
1946
1948
1947
    const psp::PrintFontManager& rMgr = psp::PrintFontManager::get();
1949
    const psp::PrintFontManager& rMgr = psp::PrintFontManager::get();
1948
    return rMgr.Substitute( rFontSelData.maTargetName, rMissingCodes, aLangAttrib, eItalic, eWeight, eWidth, ePitch);
1950
    aRet.maSearchName = rMgr.Substitute( rFontSelData.maTargetName, rMissingCodes, aLangAttrib, eItalic, eWeight, eWidth, ePitch);
1951
1952
    switch (eItalic)
1953
    {
1954
        case psp::italic::Upright: aRet.meItalic = ITALIC_NONE; break;
1955
        case psp::italic::Italic: aRet.meItalic = ITALIC_NORMAL; break;
1956
        case psp::italic::Oblique: aRet.meItalic = ITALIC_OBLIQUE; break;
1957
        default:
1958
            break;
1959
    }
1960
1961
    switch (eWeight)
1962
    {
1963
        case psp::weight::Thin: aRet.meWeight = WEIGHT_THIN; break;
1964
        case psp::weight::UltraLight: aRet.meWeight = WEIGHT_ULTRALIGHT; break;
1965
        case psp::weight::Light: aRet.meWeight = WEIGHT_LIGHT; break;
1966
        case psp::weight::SemiLight: aRet.meWeight = WEIGHT_SEMILIGHT; break;
1967
        case psp::weight::Normal: aRet.meWeight = WEIGHT_NORMAL; break;
1968
        case psp::weight::Medium: aRet.meWeight = WEIGHT_MEDIUM; break;
1969
        case psp::weight::SemiBold: aRet.meWeight = WEIGHT_SEMIBOLD; break;
1970
        case psp::weight::Bold: aRet.meWeight = WEIGHT_BOLD; break;
1971
        case psp::weight::UltraBold: aRet.meWeight = WEIGHT_ULTRABOLD; break;
1972
        case psp::weight::Black: aRet.meWeight = WEIGHT_BLACK; break;
1973
        default:
1974
                break;
1975
    }
1976
1977
    switch (eWidth)
1978
    {
1979
        case psp::width::UltraCondensed: aRet.meWidthType = WIDTH_ULTRA_CONDENSED; break;
1980
        case psp::width::ExtraCondensed: aRet.meWidthType = WIDTH_EXTRA_CONDENSED; break;
1981
        case psp::width::Condensed: aRet.meWidthType = WIDTH_CONDENSED; break;
1982
        case psp::width::SemiCondensed: aRet.meWidthType = WIDTH_SEMI_CONDENSED; break;
1983
        case psp::width::Normal: aRet.meWidthType = WIDTH_NORMAL; break;
1984
        case psp::width::SemiExpanded: aRet.meWidthType = WIDTH_SEMI_EXPANDED; break;
1985
        case psp::width::Expanded: aRet.meWidthType = WIDTH_EXPANDED; break;
1986
        case psp::width::ExtraExpanded: aRet.meWidthType = WIDTH_EXTRA_EXPANDED; break;
1987
        case psp::width::UltraExpanded: aRet.meWidthType = WIDTH_ULTRA_EXPANDED; break;
1988
        default:
1989
            break;
1990
    }
1991
1992
    switch (ePitch)
1993
    {
1994
        case psp::pitch::Fixed: aRet.mePitch = PITCH_FIXED; break;
1995
        case psp::pitch::Variable: aRet.mePitch = PITCH_VARIABLE; break;
1996
        default:
1997
            break;
1998
    }
1999
2000
    return aRet;
2001
}
2002
2003
namespace
2004
{
2005
    bool uselessmatch(const ImplFontSelectData &rOrig, const ImplFontSelectData &rNew)
2006
    {
2007
        return
2008
          (
2009
            rOrig.maTargetName == rNew.maSearchName &&
2010
            rOrig.meWeight == rNew.meWeight &&
2011
            rOrig.meItalic == rNew.meItalic &&
2012
            rOrig.mePitch == rNew.mePitch &&
2013
            rOrig.meWidthType == rNew.meWidthType
2014
          );
2015
    }
1949
}
2016
}
1950
2017
1951
//--------------------------------------------------------------------------
2018
//--------------------------------------------------------------------------
Lines 1961-1980 Link Here
1961
        return false;
2028
        return false;
1962
2029
1963
    rtl::OUString aDummy;
2030
    rtl::OUString aDummy;
1964
    const rtl::OUString aOUName = GetFcSubstitute( rFontSelData, aDummy );
2031
    const ImplFontSelectData aOut = GetFcSubstitute( rFontSelData, aDummy );
1965
    if( !aOUName.getLength() )
2032
    if (!aOut.maSearchName.Len())
1966
        return false;
2033
        return false;
1967
    const String aName( aOUName );
2034
    if( uselessmatch(rFontSelData, aOut ) )
1968
    if( aName == rFontSelData.maTargetName )
1969
        return false;
2035
        return false;
1970
2036
1971
#ifdef DEBUG
2037
#ifdef DEBUG
1972
    ByteString aOrigName( rFontSelData.maTargetName, RTL_TEXTENCODING_UTF8 );
2038
    ByteString aOrigName( rFontSelData.maTargetName, RTL_TEXTENCODING_UTF8 );
1973
    ByteString aSubstName( aName, RTL_TEXTENCODING_UTF8 );
2039
    ByteString aSubstName( aOut.maSearchName, RTL_TEXTENCODING_UTF8 );
1974
    printf( "FcPreMatchSubstititution \"%s\" -> \"%s\"\n",
2040
    printf( "FcPreMatchSubstititution \"%s\" -> \"%s\"\n",
1975
        aOrigName.GetBuffer(), aSubstName.GetBuffer() );
2041
        aOrigName.GetBuffer(), aSubstName.GetBuffer() );
1976
#endif
2042
#endif
1977
    rFontSelData.maSearchName = aName;
2043
    rFontSelData = aOut;
1978
    return true;
2044
    return true;
1979
}
2045
}
1980
2046
Lines 1991-2011 Link Here
1991
    ||  0 == rFontSelData.maSearchName.CompareIgnoreCaseToAscii( "opensymbol", 10) )
2057
    ||  0 == rFontSelData.maSearchName.CompareIgnoreCaseToAscii( "opensymbol", 10) )
1992
        return false;
2058
        return false;
1993
2059
1994
    const rtl::OUString aOUName = GetFcSubstitute( rFontSelData, rMissingCodes );
2060
    const ImplFontSelectData aOut = GetFcSubstitute( rFontSelData, rMissingCodes );
1995
    // TODO: cache the unicode+font specific result
2061
    // TODO: cache the unicode+font specific result
1996
    if( !aOUName.getLength() )
2062
    if (!aOut.maSearchName.Len())
1997
        return false;
2063
        return false;
1998
    const String aName( aOUName );
2064
    if (uselessmatch(rFontSelData, aOut))
1999
    if( aName == rFontSelData.maTargetName )
2000
        return false;
2065
        return false;
2001
2066
2002
#ifdef DEBUG
2067
#ifdef DEBUG
2003
    ByteString aOrigName( rFontSelData.maTargetName, RTL_TEXTENCODING_UTF8 );
2068
    ByteString aOrigName( rFontSelData.maTargetName, RTL_TEXTENCODING_UTF8 );
2004
    ByteString aSubstName( aName, RTL_TEXTENCODING_UTF8 );
2069
    ByteString aSubstName( aOut.maSearchName, RTL_TEXTENCODING_UTF8 );
2005
    printf( "FcGlyphFallbackSubstititution \"%s\" -> \"%s\"\n",
2070
    printf( "FcGlyphFallbackSubstititution \"%s\" -> \"%s\"\n",
2006
        aOrigName.GetBuffer(), aSubstName.GetBuffer() );
2071
        aOrigName.GetBuffer(), aSubstName.GetBuffer() );
2007
#endif
2072
#endif
2008
    rFontSelData.maSearchName = aName;
2073
    rFontSelData = aOut;
2009
    return true;
2074
    return true;
2010
}
2075
}
2011
2076

Return to issue 87970