[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677
darin
darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 07:31:27 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit 89c41f34fc8432a4e424dccc6795ac0068fd8b35
Author: darin <darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Tue Mar 25 01:40:34 2003 +0000
Reviewed by Dave.
- fixed 3206803 -- REGRESSION: Lucida Handwriting font doesn't work
* WebCoreSupport.subproj/WebTextRendererFactory.m:
(acceptableChoice): Added. Returns NO if the weight/traits are no good.
(betterChoice): Added. Returns YES if the new weight/traits are better than the old.
(-[WebTextRendererFactory fontWithFamily:traits:size:]): Use the new functions to judge which
font is good enough. Now it will accept an italic font if that's all we have.
- fixed 3206904 -- use "Lucida Handwriting" for "cursive" so it works on systems without Classic
* WebView.subproj/WebPreferences.m: (+[WebPreferences initialize]):
Change default from "Apple Chancery" to "Lucida Handwriting".
* English.lproj/StringsNotToBeLocalized.txt: Updated for this change.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@3912 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 8a9214e..0db4119 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,22 @@
+2003-03-24 Darin Adler <darin at apple.com>
+
+ Reviewed by Dave.
+
+ - fixed 3206803 -- REGRESSION: Lucida Handwriting font doesn't work
+
+ * WebCoreSupport.subproj/WebTextRendererFactory.m:
+ (acceptableChoice): Added. Returns NO if the weight/traits are no good.
+ (betterChoice): Added. Returns YES if the new weight/traits are better than the old.
+ (-[WebTextRendererFactory fontWithFamily:traits:size:]): Use the new functions to judge which
+ font is good enough. Now it will accept an italic font if that's all we have.
+
+ - fixed 3206904 -- use "Lucida Handwriting" for "cursive" so it works on systems without Classic
+
+ * WebView.subproj/WebPreferences.m: (+[WebPreferences initialize]):
+ Change default from "Apple Chancery" to "Lucida Handwriting".
+
+ * English.lproj/StringsNotToBeLocalized.txt: Updated for this change.
+
2003-03-24 Maciej Stachowiak <mjs at apple.com>
Reviewed by Richard.
diff --git a/WebKit/English.lproj/StringsNotToBeLocalized.txt b/WebKit/English.lproj/StringsNotToBeLocalized.txt
index b8f5d8b..ce46d11 100644
--- a/WebKit/English.lproj/StringsNotToBeLocalized.txt
+++ b/WebKit/English.lproj/StringsNotToBeLocalized.txt
@@ -31,7 +31,6 @@
"<!--framePath "
"="
"ANIMEXTS1"
-"Apple Chancery"
"AppleFontSmoothing"
"BufferTextDrawing"
"Content-Disposition"
@@ -66,6 +65,7 @@
"Library/Caches/com.apple.WebKit/Icons"
"Library/Internet Plug-Ins"
"Lucida Grande"
+"Lucida Handwriting"
"MP4 Audio"
"MP4 Video"
"Mozilla/4.0 (compatible; MSIE 5.2; Mac_PowerPC) AppleWebKit/%@ %@"
@@ -193,6 +193,7 @@
"about:blank"
"application/octet-stream"
"application/pdf"
+"application/postscript"
"application/x-java-applet"
"application/x-javascript"
"application/xhtml+xml"
@@ -214,9 +215,11 @@
"text/"
"text/calendar"
"text/html"
+"text/qif"
"text/rtf"
"text/vcard"
"text/x-calendar"
+"text/x-qif"
"text/x-vcard"
"text/xml"
"tiff"
diff --git a/WebKit/WebCoreSupport.subproj/WebTextRendererFactory.m b/WebKit/WebCoreSupport.subproj/WebTextRendererFactory.m
index 328bf88..d64739c 100644
--- a/WebKit/WebCoreSupport.subproj/WebTextRendererFactory.m
+++ b/WebKit/WebCoreSupport.subproj/WebTextRendererFactory.m
@@ -332,6 +332,70 @@ static int getLCDScaleParameters(void)
return font;
}
+static BOOL acceptableChoice(NSFontTraitMask desiredTraits, int desiredWeight,
+ NSFontTraitMask candidateTraits, int candidateWeight)
+{
+ return (candidateTraits & desiredTraits) == desiredTraits;
+}
+
+static BOOL betterChoice(NSFontTraitMask desiredTraits, int desiredWeight,
+ NSFontTraitMask chosenTraits, int chosenWeight,
+ NSFontTraitMask candidateTraits, int candidateWeight)
+{
+ if (!acceptableChoice(desiredTraits, desiredWeight, candidateTraits, candidateWeight)) {
+ return NO;
+ }
+
+ // A list of the traits we care about.
+ // The top item in the list is the worst trait to mismatch; if a font has this
+ // and we didn't ask for it, we'd prefer any other font in the family.
+ const NSFontTraitMask masks[] = {
+ NSPosterFontMask,
+ NSSmallCapsFontMask,
+ NSItalicFontMask,
+ NSCompressedFontMask,
+ NSCondensedFontMask,
+ NSExpandedFontMask,
+ NSNarrowFontMask,
+ NSBoldFontMask,
+ 0 };
+ int i = 0;
+ NSFontTraitMask mask;
+ while ((mask = masks[i++])) {
+ if ((desiredTraits & mask) != 0) {
+ ASSERT((chosenTraits & mask) != 0);
+ ASSERT((candidateTraits & mask) != 0);
+ continue;
+ }
+ BOOL chosenHasUnwantedTrait = (chosenTraits & mask) != 0;
+ BOOL candidateHasUnwantedTrait = (candidateTraits & mask) != 0;
+ if (!candidateHasUnwantedTrait && chosenHasUnwantedTrait) {
+ return YES;
+ }
+ if (!chosenHasUnwantedTrait && candidateHasUnwantedTrait) {
+ return NO;
+ }
+ }
+
+ int chosenWeightDelta = chosenWeight - desiredWeight;
+ int candidateWeightDelta = candidateWeight - desiredWeight;
+
+ int chosenWeightDeltaMagnitude = ABS(chosenWeightDelta);
+ int candidateWeightDeltaMagnitude = ABS(candidateWeightDelta);
+
+ // Smaller magnitude wins.
+ // If both have same magnitude, tie breaker is that the smaller weight wins.
+ // Otherwise, first font in the array wins (should almost never happen).
+ if (candidateWeightDeltaMagnitude < chosenWeightDeltaMagnitude) {
+ return YES;
+ }
+ if (candidateWeightDeltaMagnitude == chosenWeightDeltaMagnitude && candidateWeight < chosenWeight) {
+ return YES;
+ }
+
+ return NO;
+}
+
- (NSFont *)fontWithFamily:(NSString *)desiredFamily traits:(NSFontTraitMask)desiredTraits size:(float)size
{
// Do a simple case insensitive search for a matching font family.
@@ -349,7 +413,7 @@ static int getLCDScaleParameters(void)
}
// Found a family, now figure out what weight and traits to use.
- bool choseFont = false;
+ BOOL choseFont = false;
int chosenWeight = 0;
NSFontTraitMask chosenTraits = 0;
@@ -363,39 +427,23 @@ static int getLCDScaleParameters(void)
int fontWeight = [[fontInfo objectAtIndex:2] intValue];
NSFontTraitMask fontTraits = [[fontInfo objectAtIndex:3] unsignedIntValue];
- // If the traits match, then we might have a winner, depending on the weight.
- if ((fontTraits & IMPORTANT_FONT_TRAITS) == (desiredTraits & IMPORTANT_FONT_TRAITS)) {
- bool newWinner;
-
- if (!choseFont) {
- newWinner = true;
- } else {
- int chosenWeightDelta = chosenWeight - DESIRED_WEIGHT;
- int fontWeightDelta = fontWeight - DESIRED_WEIGHT;
-
- int chosenWeightDeltaMagnitude = chosenWeightDelta < 0 ? - chosenWeightDelta : chosenWeightDelta;
- int fontWeightDeltaMagnitude = fontWeightDelta < 0 ? - fontWeightDelta : fontWeightDelta;
-
- // Smaller magnitude wins.
- // If both have same magnitude, tie breaker is that the smaller weight wins.
- // Otherwise, first font in the array wins (should almost never happen).
- if (fontWeightDeltaMagnitude < chosenWeightDeltaMagnitude) {
- newWinner = true;
- } else if (fontWeightDeltaMagnitude == chosenWeightDeltaMagnitude && fontWeight < chosenWeight) {
- newWinner = true;
- } else {
- newWinner = false;
- }
- }
+ BOOL newWinner;
+
+ if (!choseFont) {
+ newWinner = acceptableChoice(desiredTraits, DESIRED_WEIGHT, fontTraits, fontWeight);
+ } else {
+ newWinner = betterChoice(desiredTraits, DESIRED_WEIGHT,
+ chosenTraits, chosenWeight, fontTraits, fontWeight);
+ }
- if (newWinner) {
- choseFont = true;
- chosenWeight = fontWeight;
- chosenTraits = fontTraits;
-
- if (chosenWeight == DESIRED_WEIGHT) {
- break;
- }
+ if (newWinner) {
+ choseFont = YES;
+ chosenWeight = fontWeight;
+ chosenTraits = fontTraits;
+
+ if (chosenWeight == DESIRED_WEIGHT
+ && (chosenTraits & IMPORTANT_FONT_TRAITS) == (desiredTraits & IMPORTANT_FONT_TRAITS)) {
+ break;
}
}
}
diff --git a/WebKit/WebView.subproj/WebPreferences.m b/WebKit/WebView.subproj/WebPreferences.m
index 19ab54e..5ce8131 100644
--- a/WebKit/WebView.subproj/WebPreferences.m
+++ b/WebKit/WebView.subproj/WebPreferences.m
@@ -70,7 +70,7 @@ NSString *WebPreferencesChangedNotification = @"WebPreferencesChangedNotificatio
@"Courier", WebKitFixedFontPreferenceKey,
@"Times New Roman", WebKitSerifFontPreferenceKey,
@"Lucida Grande", WebKitSansSerifFontPreferenceKey,
- @"Apple Chancery", WebKitCursiveFontPreferenceKey,
+ @"Lucida Handwriting", WebKitCursiveFontPreferenceKey,
@"Papyrus", WebKitFantasyFontPreferenceKey,
@"9", WebKitMinimumFontSizePreferenceKey,
@"14", WebKitDefaultFontSizePreferenceKey,
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list