Revision: 3251
          http://skim-app.svn.sourceforge.net/skim-app/?rev=3251&view=rev
Author:   hofman
Date:     2007-11-24 11:22:39 -0800 (Sat, 24 Nov 2007)

Log Message:
-----------
Use lucida handwriting for quicklook.

Modified Paths:
--------------
    trunk/QuickLook-Skim/GeneratePreviewForURL.m
    trunk/QuickLook-Skim/GenerateThumbnailForURL.m

Modified: trunk/QuickLook-Skim/GeneratePreviewForURL.m
===================================================================
--- trunk/QuickLook-Skim/GeneratePreviewForURL.m        2007-11-24 18:27:52 UTC 
(rev 3250)
+++ trunk/QuickLook-Skim/GeneratePreviewForURL.m        2007-11-24 19:22:39 UTC 
(rev 3251)
@@ -92,10 +92,16 @@
         
         NSData *data = [[NSData alloc] initWithContentsOfURL:(NSURL *)url 
options:NSUncachedRead error:NULL];
         if (data) {
-            NSMutableString *htmlString = [[NSMutableString alloc] 
initWithString:@"<html><body><dl>\n"];
+            NSMutableString *htmlString = [[NSMutableString alloc] init];
             NSArray *array = [NSKeyedUnarchiver unarchiveObjectWithData:data];
             [data release];
             
+            [htmlString appendString:@"<html><head><style type=\"text/css\">"];
+            [htmlString appendString:@"body {font-family:Helvetica} "];
+            [htmlString appendString:@"dd 
{font-family:LucidaHandwriting-Italic, Helvetica;font-style:italic} "];
+            [htmlString appendString:@".note-text {font-size:smaller} "];
+            [htmlString appendString:@"</style></head><body><dl>"];
+            
             if (array) {
                 NSSortDescriptor *sortDescriptor = [[[NSSortDescriptor alloc] 
initWithKey:@"pageIndex" ascending:YES] autorelease];
                 NSEnumerator *noteEnum = [[array 
sortedArrayUsingDescriptors:[NSArray arrayWithObject:sortDescriptor]] 
objectEnumerator];
@@ -107,9 +113,9 @@
                     NSColor *color = [note objectForKey:@"color"];
                     unsigned int pageIndex = [[note objectForKey:@"pageIndex"] 
unsignedIntValue];
                     [htmlString appendFormat:@"<dt><img src=\"cid:%@.png\" 
style=\"background-color:#\" />%@ (page %i)</dt>", type, [color hexString], 
type, pageIndex+1];
-                    [htmlString appendFormat:@"<dd><b>%@</b>", contents];
+                    [htmlString appendFormat:@"<dd>%@", contents];
                     if (text)
-                        [htmlString appendFormat:@"<br />%@", text];
+                        [htmlString appendFormat:@"<div 
class=\"note-text\">%@</div>", text];
                     [htmlString appendString:@"</dd>"];
                 }
             }

Modified: trunk/QuickLook-Skim/GenerateThumbnailForURL.m
===================================================================
--- trunk/QuickLook-Skim/GenerateThumbnailForURL.m      2007-11-24 18:27:52 UTC 
(rev 3250)
+++ trunk/QuickLook-Skim/GenerateThumbnailForURL.m      2007-11-24 19:22:39 UTC 
(rev 3251)
@@ -118,10 +118,12 @@
                 [data release];
                 
                 NSMutableAttributedString *attrString = 
[[NSMutableAttributedString alloc] init];
-                NSFont *font = [self userFontOfSize:0.0];
-                NSFont *boldFont = [[NSFontManager sharedFontManager] 
convertFont:font toHaveTrait:NSBoldFontMask];
+                NSFont *font = [NSFont userFontOfSize:0.0];
+                NSFont *noteFont = [NSFont 
fontWithName:@"LucidaHandwriting-Italic" size:[font pointSize]];
+                NSFont *noteTextFont = [NSFont 
fontWithName:@"LucidaHandwriting-Italic" size:[font pointSize] - 2.0];
                 NSDictionary *attrs = [NSDictionary 
dictionaryWithObjectsAndKeys:font, NSFontAttributeName, nil];
-                NSDictionary *boldAttrs = [NSDictionary 
dictionaryWithObjectsAndKeys:boldFont, NSFontAttributeName, [NSParagraphStyle 
defaultParagraphStyle], NSParagraphStyleAttributeName, nil];
+                NSDictionary *noteAttrs = [NSDictionary 
dictionaryWithObjectsAndKeys:noteFont, NSFontAttributeName, [NSParagraphStyle 
defaultParagraphStyle], NSParagraphStyleAttributeName, nil];
+                NSDictionary *noteTextAttrs = [NSDictionary 
dictionaryWithObjectsAndKeys:noteTextFont, NSFontAttributeName, 
[NSParagraphStyle defaultParagraphStyle], NSParagraphStyleAttributeName, nil];
                 NSMutableParagraphStyle *noteParStyle = [[[NSParagraphStyle 
defaultParagraphStyle] mutableCopy] autorelease];
                 [noteParStyle setFirstLineHeadIndent:20.0];
                 [noteParStyle setHeadIndent:20.0];
@@ -142,10 +144,10 @@
                         [attrString 
addAttribute:NSBackgroundColorAttributeName value:color 
range:NSMakeRange([attrString length] - 1, 1)];
                         [attrString 
appendAttributedString:[[[NSAttributedString alloc] initWithString:[NSString 
stringWithFormat:@"%@ (page %i)\n", type, pageIndex+1] attributes:attrs] 
autorelease]];
                         start = [attrString length];
-                        [attrString 
appendAttributedString:[[[NSAttributedString alloc] initWithString:contents 
attributes:boldAttrs] autorelease]];
+                        [attrString 
appendAttributedString:[[[NSAttributedString alloc] initWithString:contents 
attributes:noteAttrs] autorelease]];
                         if (text) {
                             [attrString 
appendAttributedString:[[[NSAttributedString alloc] initWithString:@"\n"] 
autorelease]];
-                            [attrString 
appendAttributedString:[[[NSAttributedString alloc] initWithString:text 
attributes:attrs] autorelease]];
+                            [attrString 
appendAttributedString:[[[NSAttributedString alloc] initWithString:text 
attributes:noteTextAttrs] autorelease]];
                         }
                         [attrString 
appendAttributedString:[[[NSAttributedString alloc] initWithString:@"\n"] 
autorelease]];
                         [attrString addAttribute:NSParagraphStyleAttributeName 
value:noteParStyle range:NSMakeRange(start, [attrString length] - start)];


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to