Kaydet (Commit) c7a9318f authored tarafından Caolán McNamara's avatar Caolán McNamara

sort fonts so that upright faces are shown in the font dropdown list

Change font sort so that font faces like those of URW Palladio L whose italic
variant is lighter than its upright variant are sorted with the upright fonts
first so we don't see italic variants in the font widget.

Also sort "normal" weight faces below all other weights

Change-Id: I9c81b475d95b9dd17a873fd791b942512ff039c7
üst e78b7160
......@@ -123,19 +123,33 @@ private:
{}
};
// =======================================================================
//sort normal to the start
static int sortWeightValue(FontWeight eWeight)
{
if (eWeight == WEIGHT_NORMAL)
return 0;
if (eWeight < WEIGHT_NORMAL)
return eWeight + 1;
if (eWeight > WEIGHT_NORMAL)
return eWeight - 1;
}
static StringCompare ImplCompareFontInfo( ImplFontListFontInfo* pInfo1,
ImplFontListFontInfo* pInfo2 )
{
if ( pInfo1->GetWeight() < pInfo2->GetWeight() )
//Sort non italic before italics
if ( pInfo1->GetItalic() < pInfo2->GetItalic() )
return COMPARE_LESS;
else if ( pInfo1->GetWeight() > pInfo2->GetWeight() )
else if ( pInfo1->GetItalic() > pInfo2->GetItalic() )
return COMPARE_GREATER;
if ( pInfo1->GetItalic() < pInfo2->GetItalic() )
//Sort normal weight to the start, followed by lightest to heaviest weights
int nWeight1 = sortWeightValue(pInfo1->GetWeight());
int nWeight2 = sortWeightValue(pInfo2->GetWeight());
if ( nWeight1 < nWeight2 )
return COMPARE_LESS;
else if ( pInfo1->GetItalic() > pInfo2->GetItalic() )
else if ( nWeight1 > nWeight2 )
return COMPARE_GREATER;
return pInfo1->GetStyleName().CompareTo( pInfo2->GetStyleName() );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment