34#include <svtools/strings.hrc>
81class ImplFontListFontMetric :
public FontMetric
86 ImplFontListFontMetric*
mpNext;
89 ImplFontListFontMetric(
const FontMetric& rInfo ) :
96enum class FontListFontNameType
137 ImplFontListFontMetric* pInfo2 )
140 if ( pInfo1->GetItalic() < pInfo2->GetItalic() )
142 else if ( pInfo1->GetItalic() > pInfo2->GetItalic() )
149 if ( nWeight1 < nWeight2 )
151 else if ( nWeight1 > nWeight2 )
154 return pInfo1->GetStyleName().compareTo( pInfo2->GetStyleName() );
159 return rStr.toAsciiLowerCase();
165 if (
size_t nColon = rStr.find(
':'); nColon != std::u16string_view::npos)
166 if (
size_t nSemiColon = rStr.find(
';'); nSemiColon == std::u16string_view::npos || nColon < nSemiColon)
186 sal_Int32 nComp = rSearchName.compare( pCmpData->
maSearchName );
206 nMid = (nLow + nHigh) / 2;
208 sal_Int32 nComp = rSearchName.compare(pCompareData->
maSearchName);
221 pFoundData = pCompareData;
226 while ( nLow <= nHigh );
230 sal_Int32 nComp = rSearchName.compare(pCompareData->
maSearchName);
243 return ImplFind( aSearchName,
nullptr );
248 rtl_TextEncoding eSystemEncoding = osl_getThreadTextEncoding();
250 FontListFontNameType
nType;
252 nType = FontListFontNameType::SCREEN;
254 nType = FontListFontNameType::PRINTER;
264 for (
int i = 0;
i <
n; ++
i)
277 ImplFontListFontMetric* pNewInfo =
new ImplFontListFontMetric( aFontMetric );
279 pData->mpFirst = pNewInfo;
280 pNewInfo->mpNext =
nullptr;
284 std::unique_ptr<ImplFontListNameInfo>(
pData));
286 m_Entries.push_back(std::unique_ptr<ImplFontListNameInfo>(
pData));
294 ImplFontListFontMetric* pPrev =
nullptr;
295 ImplFontListFontMetric* pTemp =
pData->mpFirst;
296 ImplFontListFontMetric* pNewInfo =
new ImplFontListFontMetric( aFontMetric );
306 if ( (pTemp->GetCharSet() != eSystemEncoding) &&
307 (pNewInfo->GetCharSet() == eSystemEncoding) )
309 ImplFontListFontMetric* pTemp2 = pTemp->mpNext;
311 pTemp->mpNext = pTemp2;
321 pTemp = pTemp->mpNext;
326 pNewInfo->mpNext = pTemp;
328 pPrev->mpNext = pNewInfo;
330 pData->mpFirst = pNewInfo;
360 bool bCompareWindow =
false;
363 bCompareWindow =
true;
375 ImplFontListFontMetric *pTemp, *pInfo;
381 pTemp = pInfo->mpNext;
439 if (aStyleName.isEmpty())
444 OUString aCompareStyleName = aStyleName.toAsciiLowerCase().replaceAll(
" ",
"");
445 if (aCompareStyleName ==
"bold")
447 else if (aCompareStyleName ==
"bolditalic")
449 else if (aCompareStyleName ==
"italic")
451 else if (aCompareStyleName ==
"standard")
453 else if (aCompareStyleName ==
"regular")
455 else if (aCompareStyleName ==
"light")
457 else if (aCompareStyleName ==
"lightitalic")
459 else if (aCompareStyleName ==
"black")
461 else if (aCompareStyleName ==
"blackitalic")
464 else if (aCompareStyleName ==
"book")
465 aStyleName =
SvtResId(STR_SVT_STYLE_BOOK);
466 else if (aCompareStyleName ==
"boldoblique")
467 aStyleName =
SvtResId(STR_SVT_STYLE_BOLD_OBLIQUE);
468 else if (aCompareStyleName ==
"condensed")
469 aStyleName =
SvtResId(STR_SVT_STYLE_CONDENSED);
470 else if (aCompareStyleName ==
"condensedbold")
471 aStyleName =
SvtResId(STR_SVT_STYLE_CONDENSED_BOLD);
472 else if (aCompareStyleName ==
"condensedbolditalic")
473 aStyleName =
SvtResId(STR_SVT_STYLE_CONDENSED_BOLD_ITALIC);
474 else if (aCompareStyleName ==
"condensedboldoblique")
475 aStyleName =
SvtResId(STR_SVT_STYLE_CONDENSED_BOLD_OBLIQUE);
476 else if (aCompareStyleName ==
"condenseditalic")
477 aStyleName =
SvtResId(STR_SVT_STYLE_CONDENSED_ITALIC);
478 else if (aCompareStyleName ==
"condensedoblique")
479 aStyleName =
SvtResId(STR_SVT_STYLE_CONDENSED_OBLIQUE);
480 else if (aCompareStyleName ==
"extralight")
481 aStyleName =
SvtResId(STR_SVT_STYLE_EXTRALIGHT);
482 else if (aCompareStyleName ==
"extralightitalic")
483 aStyleName =
SvtResId(STR_SVT_STYLE_EXTRALIGHT_ITALIC);
484 else if (aCompareStyleName ==
"oblique")
485 aStyleName =
SvtResId(STR_SVT_STYLE_OBLIQUE);
486 else if (aCompareStyleName ==
"semibold")
487 aStyleName =
SvtResId(STR_SVT_STYLE_SEMIBOLD);
488 else if (aCompareStyleName ==
"semibolditalic")
489 aStyleName =
SvtResId(STR_SVT_STYLE_SEMIBOLD_ITALIC);
491 else if (aCompareStyleName ==
"medium")
492 aStyleName =
SvtResId(STR_SVT_STYLE_MEDIUM);
493 else if (aCompareStyleName ==
"mediumitalic")
494 aStyleName =
SvtResId(STR_SVT_STYLE_MEDIUM_ITALIC);
531 if (!rStyleName.isEmpty())
533 bool bNotSynthetic =
false;
536 ImplFontListFontMetric* pFontMetric =
pData->mpFirst;
537 while ( pFontMetric )
539 if ( (eWeight == pFontMetric->GetWeight()) &&
540 (eItalic == pFontMetric->GetItalic()) )
542 bNotSynthetic =
true;
546 pFontMetric = pFontMetric->mpNext;
549 if ( !bNotSynthetic )
558 if (
nType == FontListFontNameType::PRINTER )
574 FontMetric makeMissing(ImplFontListFontMetric
const * pFontNameInfo, std::u16string_view rName,
581 aInfo = *pFontNameInfo;
590 if (ConvertChar::GetRecodeData(rName, u
"OpenSymbol"))
600 ImplFontListFontMetric* pFontMetric =
nullptr;
601 ImplFontListFontMetric* pFontNameInfo =
nullptr;
604 ImplFontListFontMetric* pSearchInfo =
pData->mpFirst;
605 pFontNameInfo = pSearchInfo;
606 pSearchInfo =
pData->mpFirst;
607 while ( pSearchInfo )
609 if (rStyleName.equalsIgnoreAsciiCase(
GetStyleName(*pSearchInfo)))
611 pFontMetric = pSearchInfo;
615 pSearchInfo = pSearchInfo->mpNext;
636 else if ( rStyleName ==
maBold )
646 else if ( rStyleName ==
maLight )
656 else if ( rStyleName ==
maBlack )
666 aInfo = makeMissing(pFontNameInfo, rName, eWeight, eItalic);
669 aInfo = *pFontMetric;
682 ImplFontListFontMetric* pFontMetric =
nullptr;
683 ImplFontListFontMetric* pFontNameInfo =
nullptr;
686 ImplFontListFontMetric* pSearchInfo =
pData->mpFirst;
687 pFontNameInfo = pSearchInfo;
688 while ( pSearchInfo )
690 if ( (eWeight == pSearchInfo->GetWeight()) &&
691 (eItalic == pSearchInfo->GetItalic()) )
693 pFontMetric = pSearchInfo;
697 pSearchInfo = pSearchInfo->mpNext;
704 aInfo = makeMissing(pFontNameInfo, rName, eWeight, eItalic);
706 aInfo = *pFontMetric;
737 ImplFontListFontMetric* pInfo =
static_cast<ImplFontListFontMetric*
>(hFontMetric);
738 return static_cast<sal_Handle>(pInfo->mpNext);
743 ImplFontListFontMetric* pInfo =
static_cast<ImplFontListFontMetric*
>(hFontMetric);
755 { 50,
"\xe5\x85\xab\xe5\x8f\xb7" },
756 { 55,
"\xe4\xb8\x83\xe5\x8f\xb7" },
757 { 65,
"\xe5\xb0\x8f\xe5\x85\xad" },
758 { 75,
"\xe5\x85\xad\xe5\x8f\xb7" },
759 { 90,
"\xe5\xb0\x8f\xe4\xba\x94" },
760 { 105,
"\xe4\xba\x94\xe5\x8f\xb7" },
761 { 120,
"\xe5\xb0\x8f\xe5\x9b\x9b" },
762 { 140,
"\xe5\x9b\x9b\xe5\x8f\xb7" },
763 { 150,
"\xe5\xb0\x8f\xe4\xb8\x89" },
764 { 160,
"\xe4\xb8\x89\xe5\x8f\xb7" },
765 { 180,
"\xe5\xb0\x8f\xe4\xba\x8c" },
766 { 220,
"\xe4\xba\x8c\xe5\x8f\xb7" },
767 { 240,
"\xe5\xb0\x8f\xe4\xb8\x80" },
768 { 260,
"\xe4\xb8\x80\xe5\x8f\xb7" },
769 { 360,
"\xe5\xb0\x8f\xe5\x88\x9d" },
770 { 420,
"\xe5\x88\x9d\xe5\x8f\xb7" }
775 if ( eLanguage == LANGUAGE_DONTKNOW )
777 if ( eLanguage == LANGUAGE_SYSTEM )
793sal_Int32 FontSizeNames::Name2Size( std::u16string_view rName )
const
798 RTL_TEXTENCODING_UTF8));
802 if ( aName == mpArray[i].mszUtf8Name )
809OUString FontSizeNames::Size2Name( sal_Int32 nValue )
const
814 for(
tools::Long lower = 0, upper = mnElem - 1; lower <= upper; )
817 if ( nValue == mpArray[mid].mnSize )
819 aStr = OUString( mpArray[mid].mszUtf8Name, strlen(mpArray[mid].mszUtf8Name), RTL_TEXTENCODING_UTF8 );
822 else if ( nValue < mpArray[mid].mnSize )
831OUString FontSizeNames::GetIndexName( sal_Int32 nIndex )
const
835 if ( nIndex < mnElem )
836 aStr = OUString( mpArray[nIndex].mszUtf8Name, strlen(mpArray[nIndex].mszUtf8Name), RTL_TEXTENCODING_UTF8 );
841sal_Int32 FontSizeNames::GetIndexSize( sal_Int32 nIndex )
const
843 if ( nIndex >= mnElem )
const LanguageTag & GetUILanguageTag() const
static OutputDevice * GetDefaultDevice()
static const AllSettings & GetSettings()
OUString GetFontMapText(const FontMetric &rFontMetric) const
std::unique_ptr< FontList > Clone() const
SVT_DLLPRIVATE ImplFontListNameInfo * ImplFindByName(std::u16string_view rStr) const
VclPtr< OutputDevice > mpDev
OUString maMapStyleNotAvailable
OUString maMapPrinterOnly
FontMetric Get(const OUString &rName, const OUString &rStyleName) const
size_t GetFontNameCount() const
static sal_Handle GetNextFontMetric(sal_Handle hFontMetric)
SVT_DLLPRIVATE ImplFontListNameInfo * ImplFind(std::u16string_view rSearchName, sal_uInt32 *pIndex) const
static const FontMetric & GetFontMetric(sal_Handle hFontMetric)
std::vector< std::unique_ptr< ImplFontListNameInfo > > m_Entries
VclPtr< OutputDevice > mpDev2
SVT_DLLPRIVATE void ImplInsertFonts(OutputDevice *pDev, bool bInsertData)
static const int aStdSizeAry[]
OUString maMapNotAvailable
FontList(OutputDevice *pDevice, OutputDevice *pDevice2=nullptr)
bool IsAvailable(std::u16string_view rName) const
sal_Handle GetFirstFontMetric(std::u16string_view rName) const
const OUString & GetStyleName(FontWeight eWeight, FontItalic eItalic) const
const FontMetric & GetFontName(size_t nFont) const
FontListFontNameType mnType
ImplFontListFontMetric * mpFirst
ImplFontListNameInfo(OUString aSearchName)
LanguageType getLanguageType(bool bResolveSystem=true) const
static LanguageType getConfiguredSystemUILanguage()
static bool isSimplifiedChinese(LanguageType nLang)
void RefreshFontData(const bool bNewFontLists)
int GetFontFaceCollectionCount() const
FontMetric GetFontMetricFromCollection(int nDevFontIndex) const
OutDevType GetOutDevType() const
void SetStyleName(const OUString &rStyleName)
const OUString & GetStyleName() const
void SetItalic(FontItalic)
void SetWeight(FontWeight)
const OUString & GetFamilyName() const
void SetCharSet(rtl_TextEncoding)
void SetFamilyName(const OUString &rFamilyName)
#define DBG_ASSERT(sCon, aError)
#define SAL_N_ELEMENTS(arr)
std::unique_ptr< sal_Int32[]> pData
std::basic_string_view< charT, traits > getToken(std::basic_string_view< charT, traits > sv, charT delimiter, std::size_t &position)
OString OUStringToOString(std::u16string_view str, ConnectionSettings const *settings)
OUString SvtResId(TranslateId aId)