Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(629)

Unified Diff: third_party/WebKit/Source/platform/fonts/mac/FontFamilyMatcherMac.mm

Issue 2386333002: reflow comments in platform/fonts (Closed)
Patch Set: comments Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/platform/fonts/mac/FontFamilyMatcherMac.mm
diff --git a/third_party/WebKit/Source/platform/fonts/mac/FontFamilyMatcherMac.mm b/third_party/WebKit/Source/platform/fonts/mac/FontFamilyMatcherMac.mm
index 424b3448dbda1c6c8136e49d2aebaf115de520c8..cef19ba2439aa1551180f19baab6b23176ff4cfd 100644
--- a/third_party/WebKit/Source/platform/fonts/mac/FontFamilyMatcherMac.mm
+++ b/third_party/WebKit/Source/platform/fonts/mac/FontFamilyMatcherMac.mm
@@ -112,7 +112,8 @@ static BOOL betterChoice(NSFontTraitMask desiredTraits,
int chosenWeightDeltaMagnitude = abs(chosenWeight - desiredWeight);
int candidateWeightDeltaMagnitude = abs(candidateWeight - desiredWeight);
- // If both are the same distance from the desired weight, prefer the candidate if it is further from medium.
+ // If both are the same distance from the desired weight, prefer the candidate
+ // if it is further from medium.
if (chosenWeightDeltaMagnitude == candidateWeightDeltaMagnitude)
return abs(candidateWeight - 6) > abs(chosenWeight - 6);
@@ -120,9 +121,10 @@ static BOOL betterChoice(NSFontTraitMask desiredTraits,
return candidateWeightDeltaMagnitude < chosenWeightDeltaMagnitude;
}
-// Family name is somewhat of a misnomer here. We first attempt to find an exact match
-// comparing the desiredFamily to the PostScript name of the installed fonts. If that fails
-// we then do a search based on the family names of the installed fonts.
+// Family name is somewhat of a misnomer here. We first attempt to find an
+// exact match comparing the desiredFamily to the PostScript name of the
+// installed fonts. If that fails we then do a search based on the family
+// names of the installed fonts.
NSFont* MatchNSFontFamily(NSString* desiredFamily,
NSFontTraitMask desiredTraits,
FontWeight desiredWeight,
@@ -165,7 +167,8 @@ NSFont* MatchNSFontFamily(NSString* desiredFamily,
// Do a simple case insensitive search for a matching font family.
// NSFontManager requires exact name matches.
- // This addresses the problem of matching arial to Arial, etc., but perhaps not all the issues.
+ // This addresses the problem of matching arial to Arial, etc., but perhaps
+ // not all the issues.
NSEnumerator* e = [[fontManager availableFontFamilies] objectEnumerator];
NSString* availableFamily;
while ((availableFamily = [e nextObject])) {
@@ -187,8 +190,8 @@ NSFont* MatchNSFontFamily(NSString* desiredFamily,
NSOrderedSame) {
nameMatchedFont = [NSFont fontWithName:availableFont size:size];
- // Special case Osaka-Mono. According to <rdar://problem/3999467>, we need to
- // treat Osaka-Mono as fixed pitch.
+ // Special case Osaka-Mono. According to <rdar://problem/3999467>, we
+ // need to treat Osaka-Mono as fixed pitch.
if ([desiredFamily caseInsensitiveCompare:@"Osaka-Mono"] ==
NSOrderedSame &&
desiredTraitsForNameMatch == 0)
@@ -260,11 +263,15 @@ NSFont* MatchNSFontFamily(NSString* desiredFamily,
bool syntheticItalic = (desiredTraits & NSFontItalicTrait) &&
!(actualTraits & NSFontItalicTrait);
- // There are some malformed fonts that will be correctly returned by -fontWithFamily:traits:weight:size: as a match for a particular trait,
- // though -[NSFontManager traitsOfFont:] incorrectly claims the font does not have the specified trait. This could result in applying
- // synthetic bold on top of an already-bold font, as reported in <http://bugs.webkit.org/show_bug.cgi?id=6146>. To work around this
- // problem, if we got an apparent exact match, but the requested traits aren't present in the matched font, we'll try to get a font from
- // the same family without those traits (to apply the synthetic traits to later).
+ // There are some malformed fonts that will be correctly returned by
+ // -fontWithFamily:traits:weight:size: as a match for a particular trait,
+ // though -[NSFontManager traitsOfFont:] incorrectly claims the font does not
+ // have the specified trait. This could result in applying
+ // synthetic bold on top of an already-bold font, as reported in
+ // <http://bugs.webkit.org/show_bug.cgi?id=6146>. To work around this
+ // problem, if we got an apparent exact match, but the requested traits
+ // aren't present in the matched font, we'll try to get a font from the same
+ // family without those traits (to apply the synthetic traits to later).
NSFontTraitMask nonSyntheticTraits = desiredTraits;
if (syntheticBold)

Powered by Google App Engine
This is Rietveld 408576698