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

(-)vcl.orig/unx/source/fontmanager/fontconfig.cxx (-2 / +140 lines)
Lines 80-85 Link Here
80
80
81
#include "sal/alloca.h"
81
#include "sal/alloca.h"
82
82
83
#include <i18nutil/unicode.hxx>  //unicode::getUnicodeScriptType
84
#include <com/sun/star/i18n/ScriptType.hdl> //ScriptType
85
83
#include <utility>
86
#include <utility>
84
#include <algorithm>
87
#include <algorithm>
85
88
Lines 907-912 Link Here
907
    }
910
    }
908
}
911
}
909
912
913
static const char* pick_sample_language(const sal_uInt32 cCode)
914
{
915
    using namespace ::com::sun::star::i18n;
916
917
    static ScriptTypeList aScripts[] =
918
    {
919
        { UnicodeScript_kBasicLatin, UnicodeScript_kBasicLatin, UnicodeScript_kBasicLatin },
920
        { UnicodeScript_kLatin1Supplement, UnicodeScript_kLatin1Supplement, UnicodeScript_kLatin1Supplement },
921
        { UnicodeScript_kLatinExtendedA, UnicodeScript_kLatinExtendedA, UnicodeScript_kLatinExtendedA },
922
        { UnicodeScript_kLatinExtendedB, UnicodeScript_kLatinExtendedB, UnicodeScript_kLatinExtendedB },
923
        { UnicodeScript_kGreek, UnicodeScript_kGreek, UnicodeScript_kGreek },
924
        { UnicodeScript_kCyrillic, UnicodeScript_kCyrillic, UnicodeScript_kCyrillic },
925
        { UnicodeScript_kArmenian, UnicodeScript_kArmenian, UnicodeScript_kArmenian },
926
        { UnicodeScript_kHebrew, UnicodeScript_kHebrew, UnicodeScript_kHebrew },
927
        { UnicodeScript_kArabic, UnicodeScript_kArabic, UnicodeScript_kArabic },
928
        { UnicodeScript_kSyriac, UnicodeScript_kSyriac, UnicodeScript_kSyriac },
929
        { UnicodeScript_kThaana, UnicodeScript_kThaana, UnicodeScript_kThaana },
930
        { UnicodeScript_kDevanagari, UnicodeScript_kDevanagari, UnicodeScript_kDevanagari },
931
        { UnicodeScript_kBengali, UnicodeScript_kBengali, UnicodeScript_kBengali },
932
        { UnicodeScript_kGurmukhi, UnicodeScript_kGurmukhi, UnicodeScript_kGurmukhi },
933
        { UnicodeScript_kGujarati, UnicodeScript_kGujarati, UnicodeScript_kGujarati },
934
        { UnicodeScript_kOriya, UnicodeScript_kOriya, UnicodeScript_kOriya },
935
        { UnicodeScript_kTamil, UnicodeScript_kTamil, UnicodeScript_kTamil },
936
        { UnicodeScript_kTelugu, UnicodeScript_kTelugu, UnicodeScript_kTelugu },
937
        { UnicodeScript_kKannada, UnicodeScript_kKannada, UnicodeScript_kKannada },
938
        { UnicodeScript_kMalayalam, UnicodeScript_kMalayalam, UnicodeScript_kMalayalam },
939
        { UnicodeScript_kSinhala, UnicodeScript_kSinhala, UnicodeScript_kSinhala },
940
        { UnicodeScript_kThai, UnicodeScript_kThai, UnicodeScript_kThai },
941
        { UnicodeScript_kLao, UnicodeScript_kLao, UnicodeScript_kLao },
942
        { UnicodeScript_kTibetan, UnicodeScript_kTibetan, UnicodeScript_kTibetan },
943
        { UnicodeScript_kMyanmar, UnicodeScript_kMyanmar, UnicodeScript_kMyanmar },
944
        { UnicodeScript_kGeorgian, UnicodeScript_kGeorgian, UnicodeScript_kGeorgian },
945
        { UnicodeScript_kHangulJamo, UnicodeScript_kHangulJamo, UnicodeScript_kHangulJamo },
946
        { UnicodeScript_kEthiopic, UnicodeScript_kEthiopic, UnicodeScript_kEthiopic },
947
        { UnicodeScript_kCherokee, UnicodeScript_kCherokee, UnicodeScript_kCherokee },
948
        { UnicodeScript_kUnifiedCanadianAboriginalSyllabics, 
949
            UnicodeScript_kUnifiedCanadianAboriginalSyllabics, 
950
            UnicodeScript_kUnifiedCanadianAboriginalSyllabics },
951
        { UnicodeScript_kKhmer, UnicodeScript_kKhmer, UnicodeScript_kKhmer },
952
        { UnicodeScript_kMongolian, UnicodeScript_kMongolian, UnicodeScript_kMongolian },
953
        { UnicodeScript_kLatinExtendedAdditional, UnicodeScript_kLatinExtendedAdditional,
954
          UnicodeScript_kLatinExtendedAdditional },
955
        { UnicodeScript_kGreekExtended, UnicodeScript_kGreekExtended, UnicodeScript_kGreekExtended },
956
        { UnicodeScript_kHiragana, UnicodeScript_kHiragana, UnicodeScript_kHiragana },
957
        { UnicodeScript_kKatakana, UnicodeScript_kKatakana, UnicodeScript_kKatakana },
958
        { UnicodeScript_kHangulCompatibilityJamo, UnicodeScript_kHangulCompatibilityJamo, 
959
          UnicodeScript_kHangulCompatibilityJamo },
960
        { UnicodeScript_kHangulSyllable, UnicodeScript_kHangulSyllable,
961
          UnicodeScript_kHangulSyllable },
962
        { UnicodeScript_kArabicPresentationB, UnicodeScript_kArabicPresentationB,
963
          UnicodeScript_kArabicPresentationB },
964
        { UnicodeScript_kScriptCount, UnicodeScript_kScriptCount, UnicodeScript_kScriptCount }
965
    };
966
967
    switch (unicode::getUnicodeScriptType(cCode, aScripts, UnicodeScript_kScriptCount))
968
    {
969
        case UnicodeScript_kBasicLatin:
970
        case UnicodeScript_kLatin1Supplement:
971
        case UnicodeScript_kLatinExtendedA:
972
        case UnicodeScript_kLatinExtendedB:
973
        case UnicodeScript_kLatinExtendedAdditional:
974
            return "en";
975
        case UnicodeScript_kGreek:
976
        case UnicodeScript_kGreekExtended:
977
            return "el";
978
        case UnicodeScript_kCyrillic:
979
            return "ru";
980
        case UnicodeScript_kArmenian:
981
            return "hy";
982
        case UnicodeScript_kHebrew:
983
            return "he";
984
        case UnicodeScript_kArabic:
985
        case UnicodeScript_kArabicPresentationB:
986
            return "ar";
987
        case UnicodeScript_kSyriac:
988
            return "syr";
989
        case UnicodeScript_kThaana:
990
            return "dv";
991
        case UnicodeScript_kDevanagari:
992
            return "hi";
993
        case UnicodeScript_kBengali:
994
            return "bn";
995
        case UnicodeScript_kGurmukhi:
996
            return "pa";
997
        case UnicodeScript_kGujarati:
998
            return "gu";
999
        case UnicodeScript_kOriya:
1000
            return "or";
1001
        case UnicodeScript_kTamil:
1002
            return "ta";
1003
        case UnicodeScript_kTelugu:
1004
            return "te";
1005
        case UnicodeScript_kKannada:
1006
            return "ka";
1007
        case UnicodeScript_kMalayalam:
1008
            return "ml";
1009
        case UnicodeScript_kSinhala:
1010
            return "si";
1011
        case UnicodeScript_kThai:
1012
            return "th";
1013
        case UnicodeScript_kLao:
1014
            return "lo";
1015
        case UnicodeScript_kTibetan:
1016
            return "bo";
1017
        case UnicodeScript_kMyanmar:
1018
            return "my";
1019
        case UnicodeScript_kGeorgian:
1020
            return "ka";
1021
        case UnicodeScript_kHangulJamo:
1022
        case UnicodeScript_kHangulCompatibilityJamo:
1023
        case UnicodeScript_kHangulSyllable:
1024
            return "ko";
1025
        case UnicodeScript_kEthiopic:
1026
            return "am";
1027
        case UnicodeScript_kCherokee:
1028
            return "chr";
1029
        case UnicodeScript_kUnifiedCanadianAboriginalSyllabics:
1030
            return "ui";
1031
        case UnicodeScript_kKhmer:
1032
            return "km";
1033
        case UnicodeScript_kMongolian:
1034
            return "mn";
1035
        case UnicodeScript_kHiragana:
1036
        case UnicodeScript_kKatakana:
1037
            return "ja";
1038
        default:
1039
            break;
1040
    }
1041
1042
    return NULL;
1043
}
1044
910
rtl::OUString PrintFontManager::Substitute(const rtl::OUString& rFontName,
1045
rtl::OUString PrintFontManager::Substitute(const rtl::OUString& rFontName,
911
    rtl::OUString& rMissingCodes, const rtl::OString &rLangAttrib,
1046
    rtl::OUString& rMissingCodes, const rtl::OString &rLangAttrib,
912
    italic::type &rItalic, weight::type &rWeight,
1047
    italic::type &rItalic, weight::type &rWeight,
Lines 928-935 Link Here
928
    rWrapper.FcPatternAddString( pPattern, FC_FAMILY, pTargetNameUtf8 );
1063
    rWrapper.FcPatternAddString( pPattern, FC_FAMILY, pTargetNameUtf8 );
929
1064
930
    const FcChar8* pLangAttribUtf8 = (FcChar8*)rLangAttrib.getStr();
1065
    const FcChar8* pLangAttribUtf8 = (FcChar8*)rLangAttrib.getStr();
931
    if( rLangAttrib.getLength() )
932
        rWrapper.FcPatternAddString( pPattern, FC_LANG, pLangAttribUtf8 );
933
1066
934
    // Add required Unicode characters, if any
1067
    // Add required Unicode characters, if any
935
    if ( rMissingCodes.getLength() )
1068
    if ( rMissingCodes.getLength() )
Lines 940-950 Link Here
940
           // also handle unicode surrogates
1073
           // also handle unicode surrogates
941
           const sal_uInt32 nCode = rMissingCodes.iterateCodePoints( &nStrIndex );
1074
           const sal_uInt32 nCode = rMissingCodes.iterateCodePoints( &nStrIndex );
942
           rWrapper.FcCharSetAddChar( unicodes, nCode );
1075
           rWrapper.FcCharSetAddChar( unicodes, nCode );
1076
           if (!pLangAttribUtf8)
1077
               pLangAttribUtf8 = (const FcChar8*)pick_sample_language(nCode);
943
       }
1078
       }
944
       rWrapper.FcPatternAddCharSet( pPattern, FC_CHARSET, unicodes);
1079
       rWrapper.FcPatternAddCharSet( pPattern, FC_CHARSET, unicodes);
945
       rWrapper.FcCharSetDestroy( unicodes );
1080
       rWrapper.FcCharSetDestroy( unicodes );
946
    }
1081
    }
947
1082
1083
    if( pLangAttribUtf8 )
1084
        rWrapper.FcPatternAddString( pPattern, FC_LANG, pLangAttribUtf8 );
1085
948
    addtopattern(rWrapper, pPattern, rItalic, rWeight, rWidth, rPitch);
1086
    addtopattern(rWrapper, pPattern, rItalic, rWeight, rWidth, rPitch);
949
1087
950
    // query fontconfig for a substitute
1088
    // query fontconfig for a substitute
(-)vcl.orig/util/makefile.mk (+1 lines)
Lines 298-303 Link Here
298
# libs for generic plugin
298
# libs for generic plugin
299
SHL2STDLIBS=\
299
SHL2STDLIBS=\
300
			$(VCLLIB)\
300
			$(VCLLIB)\
301
            $(I18NUTILLIB)      \
301
            $(I18NPAPERLIB)     \
302
            $(I18NPAPERLIB)     \
302
            $(TOOLSLIB)         \
303
            $(TOOLSLIB)         \
303
            $(VOSLIB)           \
304
            $(VOSLIB)           \

Return to issue 105784