https://bugs.documentfoundation.org/show_bug.cgi?id=96826
Bug ID: 96826
Summary: Typewriter attribute not given enough weight when
finding font based on attributes
Product: LibreOffice
Version: 3.3.0 release
Hardware: All
OS: All
Status: UNCONFIRMED
Severity: minor
Priority: medium
Component: graphics stack
Assignee: [email protected]
Reporter: [email protected]
PhysicalFontFamily::FindFontFamilyByAttributes() appears to give a weight for
typewriter attributes that is too low.
According to the comment in the source, the weighting should be:
// Calculate Match Value
// 1000000000
// 100000000
// 10000000 CJK, CTL, None-Latin, Symbol
// 1000000 FamilyName, Script, Fixed, -Special, -Decorative,
// Titling, Capitals, Outline, Shadow
// 100000 Match FamilyName, Serif, SansSerif, Italic,
// Width, Weight
// 10000 Scalable, Standard, Default,
// full, Normal, Knownfont,
// Otherstyle, +Special, +Decorative,
// 1000 Typewriter, Rounded, Gothic, Schollbook
// 100
The code starting at line 606 of PhysicalFontCollection.cxx, however, shows
that the calculation is off by a factor of 200:
609 // test MONOSPACE+TYPEWRITER attributes
610 if( nSearchType & ImplFontAttrs::Fixed )
611 {
612 if( nMatchType & ImplFontAttrs::Fixed )
613 nTestMatch += 1000000*2;
614 // a typewriter attribute is even better
615 if( ImplFontAttrs::None == ((nSearchType ^ nMatchType) &
ImplFontAttrs::Typewriter) )
616 nTestMatch += 10000*2;
617 }
However, I believe that if the font has the type ImplFontAttrs::Typewriter,
then it is just like ImplFontAttrs::Fixed and should have an additional weight
of at least 1_000_000, and due to the extra weight this is being given it
should be 2_000_000.
I've literally dug into the source history like an archeologist, and this looks
like a regressions from a long, long while ago... This code was originally in
vcl/source/gdi/outdev3.cxx, and on 2001-06-29 (!!) in commit
925806de64f97d3b11a552143d3dbd42648f64cc it looks strongly like the weighting
was typed in wrongly...
Link to commit in cgit:
http://cgit.freedesktop.org/libreoffice/core/commit/vcl/source/gdi/outdev3.cxx?id=925806de64f97d3b11a552143d3dbd42648f64cc
Anyone able to confirm if this behaviour is off? This is *very* obscure if it
is a bug, hence I've marked this as minor.
--
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
Libreoffice-bugs mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs