Lines 560-565
Link Here
|
560 |
return true; |
560 |
return true; |
561 |
} |
561 |
} |
562 |
|
562 |
|
|
|
563 |
namespace |
564 |
{ |
565 |
weight::type convertWeight(int weight) |
566 |
{ |
567 |
// set weight |
568 |
if( weight <= FC_WEIGHT_THIN ) |
569 |
return weight::Thin; |
570 |
else if( weight <= FC_WEIGHT_ULTRALIGHT ) |
571 |
return weight::UltraLight; |
572 |
else if( weight <= FC_WEIGHT_LIGHT ) |
573 |
return weight::Light; |
574 |
else if( weight <= FC_WEIGHT_BOOK ) |
575 |
return weight::SemiLight; |
576 |
else if( weight <= FC_WEIGHT_NORMAL ) |
577 |
return weight::Normal; |
578 |
else if( weight <= FC_WEIGHT_MEDIUM ) |
579 |
return weight::Medium; |
580 |
else if( weight <= FC_WEIGHT_SEMIBOLD ) |
581 |
return weight::SemiBold; |
582 |
else if( weight <= FC_WEIGHT_BOLD ) |
583 |
return weight::Bold; |
584 |
else if( weight <= FC_WEIGHT_ULTRABOLD ) |
585 |
return weight::UltraBold; |
586 |
return weight::Black; |
587 |
} |
588 |
|
589 |
italic::type convertSlant(int slant) |
590 |
{ |
591 |
// set italic |
592 |
if( slant == FC_SLANT_ITALIC ) |
593 |
return italic::Italic; |
594 |
else if( slant == FC_SLANT_OBLIQUE ) |
595 |
return italic::Oblique; |
596 |
return italic::Upright; |
597 |
} |
598 |
|
599 |
pitch::type convertSpacing(int spacing) |
600 |
{ |
601 |
// set pitch |
602 |
if( spacing == FC_MONO || spacing == FC_CHARCELL ) |
603 |
return pitch::Fixed; |
604 |
return pitch::Variable; |
605 |
} |
606 |
|
607 |
width::type convertWidth(int width) |
608 |
{ |
609 |
if (width == FC_WIDTH_ULTRACONDENSED) |
610 |
return width::UltraCondensed; |
611 |
else if (width == FC_WIDTH_EXTRACONDENSED) |
612 |
return width::ExtraCondensed; |
613 |
else if (width == FC_WIDTH_CONDENSED) |
614 |
return width::Condensed; |
615 |
else if (width == FC_WIDTH_SEMICONDENSED) |
616 |
return width::SemiCondensed; |
617 |
else if (width == FC_WIDTH_SEMIEXPANDED) |
618 |
return width::SemiExpanded; |
619 |
else if (width == FC_WIDTH_EXPANDED) |
620 |
return width::Expanded; |
621 |
else if (width == FC_WIDTH_EXTRAEXPANDED) |
622 |
return width::ExtraExpanded; |
623 |
else if (width == FC_WIDTH_ULTRAEXPANDED) |
624 |
return width::UltraExpanded; |
625 |
return width::Normal; |
626 |
} |
627 |
} |
628 |
|
563 |
int PrintFontManager::countFontconfigFonts() |
629 |
int PrintFontManager::countFontconfigFonts() |
564 |
{ |
630 |
{ |
565 |
int nFonts = 0; |
631 |
int nFonts = 0; |
Lines 687-733
Link Here
|
687 |
pUpdate->m_nFamilyName = nFamilyName; |
753 |
pUpdate->m_nFamilyName = nFamilyName; |
688 |
} |
754 |
} |
689 |
if( eWeightRes == FcResultMatch ) |
755 |
if( eWeightRes == FcResultMatch ) |
690 |
{ |
756 |
pUpdate->m_eWeight = convertWeight(weight); |
691 |
// set weight |
|
|
692 |
if( weight <= FC_WEIGHT_THIN ) |
693 |
pUpdate->m_eWeight = weight::Thin; |
694 |
else if( weight <= FC_WEIGHT_ULTRALIGHT ) |
695 |
pUpdate->m_eWeight = weight::UltraLight; |
696 |
else if( weight <= FC_WEIGHT_LIGHT ) |
697 |
pUpdate->m_eWeight = weight::Light; |
698 |
else if( weight <= FC_WEIGHT_BOOK ) |
699 |
pUpdate->m_eWeight = weight::SemiLight; |
700 |
else if( weight <= FC_WEIGHT_NORMAL ) |
701 |
pUpdate->m_eWeight = weight::Normal; |
702 |
else if( weight <= FC_WEIGHT_MEDIUM ) |
703 |
pUpdate->m_eWeight = weight::Medium; |
704 |
else if( weight <= FC_WEIGHT_SEMIBOLD ) |
705 |
pUpdate->m_eWeight = weight::SemiBold; |
706 |
else if( weight <= FC_WEIGHT_BOLD ) |
707 |
pUpdate->m_eWeight = weight::Bold; |
708 |
else if( weight <= FC_WEIGHT_ULTRABOLD ) |
709 |
pUpdate->m_eWeight = weight::UltraBold; |
710 |
else |
711 |
pUpdate->m_eWeight = weight::Black; |
712 |
} |
713 |
if( eSpacRes == FcResultMatch ) |
757 |
if( eSpacRes == FcResultMatch ) |
714 |
{ |
758 |
pUpdate->m_ePitch = convertSpacing(spacing); |
715 |
// set pitch |
|
|
716 |
if( spacing == FC_PROPORTIONAL ) |
717 |
pUpdate->m_ePitch = pitch::Variable; |
718 |
else if( spacing == FC_MONO || spacing == FC_CHARCELL ) |
719 |
pUpdate->m_ePitch = pitch::Fixed; |
720 |
} |
721 |
if( eSlantRes == FcResultMatch ) |
759 |
if( eSlantRes == FcResultMatch ) |
722 |
{ |
760 |
pUpdate->m_eItalic = convertSlant(slant); |
723 |
// set italic |
|
|
724 |
if( slant == FC_SLANT_ROMAN ) |
725 |
pUpdate->m_eItalic = italic::Upright; |
726 |
else if( slant == FC_SLANT_ITALIC ) |
727 |
pUpdate->m_eItalic = italic::Italic; |
728 |
else if( slant == FC_SLANT_OBLIQUE ) |
729 |
pUpdate->m_eItalic = italic::Oblique; |
730 |
} |
731 |
if( eStyleRes == FcResultMatch ) |
761 |
if( eStyleRes == FcResultMatch ) |
732 |
{ |
762 |
{ |
733 |
pUpdate->m_aStyleName = OStringToOUString( OString( (sal_Char*)style ), RTL_TEXTENCODING_UTF8 ); |
763 |
pUpdate->m_aStyleName = OStringToOUString( OString( (sal_Char*)style ), RTL_TEXTENCODING_UTF8 ); |
Lines 867-874
Link Here
|
867 |
|
897 |
|
868 |
rtl::OUString PrintFontManager::Substitute(const rtl::OUString& rFontName, |
898 |
rtl::OUString PrintFontManager::Substitute(const rtl::OUString& rFontName, |
869 |
rtl::OUString& rMissingCodes, const rtl::OString &rLangAttrib, |
899 |
rtl::OUString& rMissingCodes, const rtl::OString &rLangAttrib, |
870 |
italic::type eItalic, weight::type eWeight, |
900 |
italic::type &rItalic, weight::type &rWeight, |
871 |
width::type eWidth, pitch::type ePitch) const |
901 |
width::type &rWidth, pitch::type &rPitch) const |
872 |
{ |
902 |
{ |
873 |
rtl::OUString aName; |
903 |
rtl::OUString aName; |
874 |
FontCfgWrapper& rWrapper = FontCfgWrapper::get(); |
904 |
FontCfgWrapper& rWrapper = FontCfgWrapper::get(); |
Lines 903-909
Link Here
|
903 |
rWrapper.FcCharSetDestroy( unicodes ); |
933 |
rWrapper.FcCharSetDestroy( unicodes ); |
904 |
} |
934 |
} |
905 |
|
935 |
|
906 |
addtopattern(rWrapper, pPattern, eItalic, eWeight, eWidth, ePitch); |
936 |
addtopattern(rWrapper, pPattern, rItalic, rWeight, rWidth, rPitch); |
907 |
|
937 |
|
908 |
// query fontconfig for a substitute |
938 |
// query fontconfig for a substitute |
909 |
rWrapper.FcConfigSubstitute( rWrapper.FcConfigGetCurrent(), pPattern, FcMatchPattern ); |
939 |
rWrapper.FcConfigSubstitute( rWrapper.FcConfigGetCurrent(), pPattern, FcMatchPattern ); |
Lines 940-945
Link Here
|
940 |
if (aI != rWrapper.m_aFontNameToLocalized.end()) |
970 |
if (aI != rWrapper.m_aFontNameToLocalized.end()) |
941 |
sFamily = aI->second; |
971 |
sFamily = aI->second; |
942 |
aName = rtl::OStringToOUString( sFamily, RTL_TEXTENCODING_UTF8 ); |
972 |
aName = rtl::OStringToOUString( sFamily, RTL_TEXTENCODING_UTF8 ); |
|
|
973 |
|
974 |
|
975 |
int val = 0; |
976 |
if ( FcResultMatch == rWrapper.FcPatternGetInteger( pSet->fonts[0], FC_WEIGHT, 0, &val)) |
977 |
rWeight = convertWeight(val); |
978 |
if ( FcResultMatch == rWrapper.FcPatternGetInteger( pSet->fonts[0], FC_SLANT, 0, &val)) |
979 |
rItalic = convertSlant(val); |
980 |
if ( FcResultMatch == rWrapper.FcPatternGetInteger( pSet->fonts[0], FC_SPACING, 0, &val)) |
981 |
rPitch = convertSpacing(val); |
982 |
if ( FcResultMatch == rWrapper.FcPatternGetInteger( pSet->fonts[0], FC_WIDTH, 0, &val)) |
983 |
rWidth = convertWidth(val); |
943 |
} |
984 |
} |
944 |
|
985 |
|
945 |
// update rMissingCodes by removing resolved unicodes |
986 |
// update rMissingCodes by removing resolved unicodes |