mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-10-05 16:42:58 +00:00
move fontHeight to where it is needed
This commit is contained in:
1 parent
4c7ce97650
commit
92f471c476
1 file changed
+6
-5
@@ -65,15 +65,11 @@ CPStringSizeCachingEnabled = YES;
|
||||
|
||||
var cssString = [aFont cssString],
|
||||
cacheKey = self + cssString + aWidth,
|
||||
size = CPStringSizeWithFontInWidthCache[cacheKey],
|
||||
fontHeight = CPStringSizeWithFontHeightCache[cssString];
|
||||
size = CPStringSizeWithFontInWidthCache[cacheKey];
|
||||
|
||||
if (size !== undefined)
|
||||
return CGSizeMakeCopy(size);
|
||||
|
||||
if (fontHeight === undefined)
|
||||
fontHeight = CPStringSizeWithFontHeightCache[cssString] = [aFont defaultLineHeightForFont];
|
||||
|
||||
if (!CPStringSizeMeasuringContext)
|
||||
CPStringSizeMeasuringContext = CGBitmapGraphicsContextCreate();
|
||||
|
||||
@@ -92,6 +88,11 @@ CPStringSizeCachingEnabled = YES;
|
||||
if (CPStringSizeMeasuringContext.font !== aFont)
|
||||
CPStringSizeMeasuringContext.font = cssString;
|
||||
|
||||
var fontHeight = CPStringSizeWithFontHeightCache[cssString];
|
||||
|
||||
if (fontHeight === undefined)
|
||||
fontHeight = CPStringSizeWithFontHeightCache[cssString] = [aFont defaultLineHeightForFont];
|
||||
|
||||
size = CGSizeMake(CPStringSizeMeasuringContext.measureText(self).width, fontHeight);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user