|
From: <de...@us...> - 2009-09-22 01:06:17
|
Revision: 1824
http://iterm.svn.sourceforge.net/iterm/?rev=1824&view=rev
Author: delx
Date: 2009-09-22 01:06:10 +0000 (Tue, 22 Sep 2009)
Log Message:
-----------
Faster bold text rendering + separation between bold & highlight attributes
Modified Paths:
--------------
trunk/Changelog
trunk/PTYTextView.m
Modified: trunk/Changelog
===================================================================
--- trunk/Changelog 2009-09-20 01:56:05 UTC (rev 1823)
+++ trunk/Changelog 2009-09-22 01:06:10 UTC (rev 1824)
@@ -1,3 +1,9 @@
+2009-09-22 delx
+ * Draw bold text the old fashioned way, much faster
+ * Separate bold & highlight attributes for text
+ * New behaviour gives four distinct modes -- plain, bold, highlight, bold+highlight
+ Use the disable bold option to collapse the last 3 into one
+
2009-09-20 delx
* Fixed blinking text
* Fixed drawing corruption when new text is placed into a full buffer is not scrolled to the bottom
Modified: trunk/PTYTextView.m
===================================================================
--- trunk/PTYTextView.m 2009-09-20 01:56:05 UTC (rev 1823)
+++ trunk/PTYTextView.m 2009-09-22 01:06:10 UTC (rev 1824)
@@ -377,7 +377,7 @@
}
}
else {
- if((index & BOLD_MASK) && (index % 256 < 8)) {
+ if([self disableBold] && (index & BOLD_MASK) && (index % 256 < 8)) {
index = index - BOLD_MASK + 8;
}
color = colorTable[index & 0xff];
@@ -2472,60 +2472,21 @@
- (void) _drawCharacter:(unichar)code fgColor:(int)fg AtX:(float)X Y:(float)Y doubleWidth:(BOOL) dw
{
- if (!code) {
- return;
- }
+ if (!code) return;
- //NSLog(@"%s: %c(%d)",__PRETTY_FUNCTION__, code,code);
- //
- NSColor* color;
- NSString* crap;
- NSDictionary* attrib;
- NSFont* theFont;
- float sw;
- BOOL renderBold;
- NSFontManager* fontManager = [NSFontManager sharedFontManager];
+ NSFont* theFont = dw?nafont:font;
+ BOOL renderBold = (fg&BOLD_MASK) && ![self disableBold];
+ NSColor* color = [self colorForCode: fg];
- theFont = dw?nafont:font;
- renderBold = (fg&BOLD_MASK) && ![self disableBold];
- color = [self colorForCode: fg];
-
- if(renderBold) {
- theFont = [fontManager convertFont: theFont toHaveTrait: NSBoldFontMask];
-
- // Check if there is native bold support
- // if conversion was successful, else use our own methods to convert to bold
- if ([fontManager traitsOfFont:theFont] & NSBoldFontMask) {
- sw = antiAlias ? strokeWidth:0;
- renderBold = NO;
- }
- else {
- sw = antiAlias? boldStrokeWidth : 0;
- }
- }
- else {
- sw = antiAlias ? strokeWidth:0;
- }
+ NSDictionary* attrib=[NSDictionary dictionaryWithObjectsAndKeys:
+ theFont, NSFontAttributeName, color, NSForegroundColorAttributeName,
+ nil];
- if (OSX_TIGERORLATER && sw) {
- attrib=[NSDictionary dictionaryWithObjectsAndKeys:
- theFont, NSFontAttributeName,
- color, NSForegroundColorAttributeName,
- [NSNumber numberWithFloat: sw], @"NSStrokeWidth",
- nil];
- }
- else {
- attrib=[NSDictionary dictionaryWithObjectsAndKeys:
- theFont, NSFontAttributeName,
- color, NSForegroundColorAttributeName,
- nil];
- }
-
- crap = [NSString stringWithCharacters:&code length:1];
+ NSString* crap = [NSString stringWithCharacters:&code length:1];
[crap drawWithRect:NSMakeRect(X,Y+[theFont ascender], 0, 0) options:0 attributes:attrib];
// on older systems, for bold, redraw the character offset by 1 pixel
- if (renderBold && (!OSX_TIGERORLATER || !antiAlias)) {
+ if (renderBold) {
[crap drawWithRect:NSMakeRect(X+1,Y+[theFont ascender], 0, 0) options:0 attributes:attrib];
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|