Lines 581-586
Link Here
|
581 |
return true; |
581 |
return true; |
582 |
} |
582 |
} |
583 |
|
583 |
|
|
|
584 |
namespace |
585 |
{ |
586 |
weight::type convertWeight(int weight) |
587 |
{ |
588 |
// set weight |
589 |
if( weight <= FC_WEIGHT_THIN ) |
590 |
return weight::Thin; |
591 |
else if( weight <= FC_WEIGHT_ULTRALIGHT ) |
592 |
return weight::UltraLight; |
593 |
else if( weight <= FC_WEIGHT_LIGHT ) |
594 |
return weight::Light; |
595 |
else if( weight <= FC_WEIGHT_BOOK ) |
596 |
return weight::SemiLight; |
597 |
else if( weight <= FC_WEIGHT_NORMAL ) |
598 |
return weight::Normal; |
599 |
else if( weight <= FC_WEIGHT_MEDIUM ) |
600 |
return weight::Medium; |
601 |
else if( weight <= FC_WEIGHT_SEMIBOLD ) |
602 |
return weight::SemiBold; |
603 |
else if( weight <= FC_WEIGHT_BOLD ) |
604 |
return weight::Bold; |
605 |
else if( weight <= FC_WEIGHT_ULTRABOLD ) |
606 |
return weight::UltraBold; |
607 |
return weight::Black; |
608 |
} |
609 |
|
610 |
italic::type convertSlant(int slant) |
611 |
{ |
612 |
// set italic |
613 |
if( slant == FC_SLANT_ITALIC ) |
614 |
return italic::Italic; |
615 |
else if( slant == FC_SLANT_OBLIQUE ) |
616 |
return italic::Oblique; |
617 |
return italic::Upright; |
618 |
} |
619 |
|
620 |
pitch::type convertSpacing(int spacing) |
621 |
{ |
622 |
// set pitch |
623 |
if( spacing == FC_MONO || spacing == FC_CHARCELL ) |
624 |
return pitch::Fixed; |
625 |
return pitch::Variable; |
626 |
} |
627 |
|
628 |
width::type convertWidth(int width) |
629 |
{ |
630 |
if (width == FC_WIDTH_ULTRACONDENSED) |
631 |
return width::UltraCondensed; |
632 |
else if (width == FC_WIDTH_EXTRACONDENSED) |
633 |
return width::ExtraCondensed; |
634 |
else if (width == FC_WIDTH_CONDENSED) |
635 |
return width::Condensed; |
636 |
else if (width == FC_WIDTH_SEMICONDENSED) |
637 |
return width::SemiCondensed; |
638 |
else if (width == FC_WIDTH_SEMIEXPANDED) |
639 |
return width::SemiExpanded; |
640 |
else if (width == FC_WIDTH_EXPANDED) |
641 |
return width::Expanded; |
642 |
else if (width == FC_WIDTH_EXTRAEXPANDED) |
643 |
return width::ExtraExpanded; |
644 |
else if (width == FC_WIDTH_ULTRAEXPANDED) |
645 |
return width::UltraExpanded; |
646 |
return width::Normal; |
647 |
} |
648 |
} |
649 |
|
584 |
int PrintFontManager::countFontconfigFonts() |
650 |
int PrintFontManager::countFontconfigFonts() |
585 |
{ |
651 |
{ |
586 |
int nFonts = 0; |
652 |
int nFonts = 0; |
Lines 709-755
Link Here
|
709 |
pUpdate->m_nFamilyName = nFamilyName; |
775 |
pUpdate->m_nFamilyName = nFamilyName; |
710 |
} |
776 |
} |
711 |
if( eWeightRes == FcResultMatch ) |
777 |
if( eWeightRes == FcResultMatch ) |
712 |
{ |
778 |
pUpdate->m_eWeight = convertWeight(weight); |
713 |
// set weight |
|
|
714 |
if( weight <= FC_WEIGHT_THIN ) |
715 |
pUpdate->m_eWeight = weight::Thin; |
716 |
else if( weight <= FC_WEIGHT_ULTRALIGHT ) |
717 |
pUpdate->m_eWeight = weight::UltraLight; |
718 |
else if( weight <= FC_WEIGHT_LIGHT ) |
719 |
pUpdate->m_eWeight = weight::Light; |
720 |
else if( weight <= FC_WEIGHT_BOOK ) |
721 |
pUpdate->m_eWeight = weight::SemiLight; |
722 |
else if( weight <= FC_WEIGHT_NORMAL ) |
723 |
pUpdate->m_eWeight = weight::Normal; |
724 |
else if( weight <= FC_WEIGHT_MEDIUM ) |
725 |
pUpdate->m_eWeight = weight::Medium; |
726 |
else if( weight <= FC_WEIGHT_SEMIBOLD ) |
727 |
pUpdate->m_eWeight = weight::SemiBold; |
728 |
else if( weight <= FC_WEIGHT_BOLD ) |
729 |
pUpdate->m_eWeight = weight::Bold; |
730 |
else if( weight <= FC_WEIGHT_ULTRABOLD ) |
731 |
pUpdate->m_eWeight = weight::UltraBold; |
732 |
else |
733 |
pUpdate->m_eWeight = weight::Black; |
734 |
} |
735 |
if( eSpacRes == FcResultMatch ) |
779 |
if( eSpacRes == FcResultMatch ) |
736 |
{ |
780 |
pUpdate->m_ePitch = convertSpacing(spacing); |
737 |
// set pitch |
|
|
738 |
if( spacing == FC_PROPORTIONAL ) |
739 |
pUpdate->m_ePitch = pitch::Variable; |
740 |
else if( spacing == FC_MONO || spacing == FC_CHARCELL ) |
741 |
pUpdate->m_ePitch = pitch::Fixed; |
742 |
} |
743 |
if( eSlantRes == FcResultMatch ) |
781 |
if( eSlantRes == FcResultMatch ) |
744 |
{ |
782 |
pUpdate->m_eItalic = convertSlant(slant); |
745 |
// set italic |
|
|
746 |
if( slant == FC_SLANT_ROMAN ) |
747 |
pUpdate->m_eItalic = italic::Upright; |
748 |
else if( slant == FC_SLANT_ITALIC ) |
749 |
pUpdate->m_eItalic = italic::Italic; |
750 |
else if( slant == FC_SLANT_OBLIQUE ) |
751 |
pUpdate->m_eItalic = italic::Oblique; |
752 |
} |
753 |
if( eStyleRes == FcResultMatch ) |
783 |
if( eStyleRes == FcResultMatch ) |
754 |
{ |
784 |
{ |
755 |
pUpdate->m_aStyleName = OStringToOUString( OString( (sal_Char*)style ), RTL_TEXTENCODING_UTF8 ); |
785 |
pUpdate->m_aStyleName = OStringToOUString( OString( (sal_Char*)style ), RTL_TEXTENCODING_UTF8 ); |
Lines 888-895
Link Here
|
888 |
|
918 |
|
889 |
rtl::OUString PrintFontManager::Substitute(const rtl::OUString& rFontName, |
919 |
rtl::OUString PrintFontManager::Substitute(const rtl::OUString& rFontName, |
890 |
rtl::OUString& rMissingCodes, const rtl::OString &rLangAttrib, |
920 |
rtl::OUString& rMissingCodes, const rtl::OString &rLangAttrib, |
891 |
italic::type eItalic, weight::type eWeight, |
921 |
italic::type &rItalic, weight::type &rWeight, |
892 |
width::type eWidth, pitch::type ePitch) const |
922 |
width::type &rWidth, pitch::type &rPitch) const |
893 |
{ |
923 |
{ |
894 |
rtl::OUString aName; |
924 |
rtl::OUString aName; |
895 |
FontCfgWrapper& rWrapper = FontCfgWrapper::get(); |
925 |
FontCfgWrapper& rWrapper = FontCfgWrapper::get(); |
Lines 932-938
Link Here
|
932 |
rWrapper.FcCharSetDestroy( unicodes ); |
962 |
rWrapper.FcCharSetDestroy( unicodes ); |
933 |
} |
963 |
} |
934 |
|
964 |
|
935 |
addtopattern(rWrapper, pPattern, eItalic, eWeight, eWidth, ePitch); |
965 |
addtopattern(rWrapper, pPattern, rItalic, rWeight, rWidth, rPitch); |
936 |
|
966 |
|
937 |
// query fontconfig for a substitute |
967 |
// query fontconfig for a substitute |
938 |
rWrapper.FcConfigSubstitute( rWrapper.getDefConfig(), pPattern, FcMatchPattern ); |
968 |
rWrapper.FcConfigSubstitute( rWrapper.getDefConfig(), pPattern, FcMatchPattern ); |
Lines 969-974
Link Here
|
969 |
if (aI != rWrapper.m_aFontNameToLocalized.end()) |
999 |
if (aI != rWrapper.m_aFontNameToLocalized.end()) |
970 |
sFamily = aI->second; |
1000 |
sFamily = aI->second; |
971 |
aName = rtl::OStringToOUString( sFamily, RTL_TEXTENCODING_UTF8 ); |
1001 |
aName = rtl::OStringToOUString( sFamily, RTL_TEXTENCODING_UTF8 ); |
|
|
1002 |
|
1003 |
|
1004 |
fprintf(stderr, "incoming weight was %d\n", rWeight); |
1005 |
int val = 0; |
1006 |
if ( FcResultMatch == rWrapper.FcPatternGetInteger( pSet->fonts[0], FC_WEIGHT, 0, &val)) |
1007 |
rWeight = convertWeight(val); |
1008 |
if ( FcResultMatch == rWrapper.FcPatternGetInteger( pSet->fonts[0], FC_SLANT, 0, &val)) |
1009 |
rItalic = convertSlant(val); |
1010 |
if ( FcResultMatch == rWrapper.FcPatternGetInteger( pSet->fonts[0], FC_SPACING, 0, &val)) |
1011 |
rPitch = convertSpacing(val); |
1012 |
if ( FcResultMatch == rWrapper.FcPatternGetInteger( pSet->fonts[0], FC_WIDTH, 0, &val)) |
1013 |
rWidth = convertWidth(val); |
972 |
} |
1014 |
} |
973 |
|
1015 |
|
974 |
// update rMissingCodes by removing resolved unicodes |
1016 |
// update rMissingCodes by removing resolved unicodes |