Revision: 3268
          http://skim-app.svn.sourceforge.net/skim-app/?rev=3268&view=rev
Author:   hofman
Date:     2007-11-26 08:04:22 -0800 (Mon, 26 Nov 2007)

Log Message:
-----------
Use different font size for thumbnail and preview.

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

Modified: trunk/QuickLook-Skim/GeneratePreviewForURL.m
===================================================================
--- trunk/QuickLook-Skim/GeneratePreviewForURL.m        2007-11-26 14:47:04 UTC 
(rev 3267)
+++ trunk/QuickLook-Skim/GeneratePreviewForURL.m        2007-11-26 16:04:22 UTC 
(rev 3268)
@@ -38,6 +38,8 @@
 #import <Cocoa/Cocoa.h>
 #import "SKQLConverter.h"
 
+static const _fontSize 12.0;
+
 /* 
-----------------------------------------------------------------------------
    Generate a preview for file
 
@@ -64,7 +66,7 @@
         
         NSData *data = [[NSData alloc] initWithContentsOfURL:(NSURL *)url 
options:NSUncachedRead error:NULL];
         if (data) {
-            NSAttributedString *attrString = [SKQLConverter 
attributedStringWithNotes:[NSKeyedUnarchiver unarchiveObjectWithData:data]];
+            NSAttributedString *attrString = [SKQLConverter 
attributedStringWithNotes:[NSKeyedUnarchiver unarchiveObjectWithData:data] 
fontSize:_fontSize];
             [data release];
             
             if (attrString && (data = [attrString RTFDFromRange:NSMakeRange(0, 
[attrString length]) documentAttributes:nil])) {

Modified: trunk/QuickLook-Skim/GenerateThumbnailForURL.m
===================================================================
--- trunk/QuickLook-Skim/GenerateThumbnailForURL.m      2007-11-26 14:47:04 UTC 
(rev 3267)
+++ trunk/QuickLook-Skim/GenerateThumbnailForURL.m      2007-11-26 16:04:22 UTC 
(rev 3268)
@@ -49,6 +49,9 @@
 static const NSSize _containerSize = (NSSize) { 572, 752 };
 static const NSRect _iconRect = (NSRect) { 50, 140, 512, 512 };
 
+// readable in Cover Flow view, and distinguishable as text in icon view
+static const _fontSize 20.0;
+
 // wash the app icon over a white page background
 static void drawBackgroundAndApplicationIconInCurrentContext()
 {
@@ -169,7 +172,7 @@
         NSData *data = [[NSData alloc] initWithContentsOfURL:(NSURL *)url 
options:NSUncachedRead error:NULL];
         
         if (data) {
-            NSAttributedString *attrString = [SKQLConverter 
attributedStringWithNotes:[NSKeyedUnarchiver unarchiveObjectWithData:data]];
+            NSAttributedString *attrString = [SKQLConverter 
attributedStringWithNotes:[NSKeyedUnarchiver unarchiveObjectWithData:data] 
fontSize:_fontSize];
             [data release];
             
             if (attrString) {

Modified: trunk/QuickLook-Skim/SKQLConverter.h
===================================================================
--- trunk/QuickLook-Skim/SKQLConverter.h        2007-11-26 14:47:04 UTC (rev 
3267)
+++ trunk/QuickLook-Skim/SKQLConverter.h        2007-11-26 16:04:22 UTC (rev 
3268)
@@ -37,5 +37,5 @@
 extern NSString *SKQLPDFPathForPDFBundleURL(NSURL *url);
 
 @interface SKQLConverter : NSObject
-- (NSAttributedString *)attributedStringWithNotes:(NSArray *)notes;
+- (NSAttributedString *)attributedStringWithNotes:(NSArray *)notes 
fontSize:(CGFloat)fontSize;
 @end

Modified: trunk/QuickLook-Skim/SKQLConverter.m
===================================================================
--- trunk/QuickLook-Skim/SKQLConverter.m        2007-11-26 14:47:04 UTC (rev 
3267)
+++ trunk/QuickLook-Skim/SKQLConverter.m        2007-11-26 16:04:22 UTC (rev 
3268)
@@ -33,10 +33,8 @@
 
 #import "SKQLConverter.h"
 
-static const NSString *_noteFont = @"LucidaHandwriting-Italic";
+static NSString *_noteFont = @"LucidaHandwriting-Italic";
 static const CGFloat _fontSize = 20.0;
-static const CGFloat _smallFontSize = 10.0;
-static const CGFloat _noteIndent = 20.0;
 
 NSBundle *SKQLGetMainBundle() { return [NSBundle 
bundleWithIdentifier:@"net.sourceforge.skim-app.quicklookgenerator"]; }
 
@@ -75,12 +73,12 @@
 
 @implementation SKQLConverter
 
-- (NSAttributedString *)attributedStringWithNotes:(NSArray *)notes;
+- (NSAttributedString *)attributedStringWithNotes:(NSArray *)notes 
fontSize:(CGFloat)fontSize;
 {
     NSMutableAttributedString *attrString = [[[NSMutableAttributedString 
alloc] init] autorelease];
     NSFont *font = [NSFont userFontOfSize:_fontSize];
-    NSFont *noteFont = [NSFont fontWithName:_noteFont size:_fontSize];
-    NSFont *noteTextFont = [NSFont fontWithName:_noteFont size:_smallFontSize];
+    NSFont *noteFont = [NSFont fontWithName:_noteFont size:fontSize];
+    NSFont *noteTextFont = [NSFont fontWithName:_noteFont size:MAX(fontSize / 
2, 10.0)];
     NSDictionary *attrs = [NSDictionary dictionaryWithObjectsAndKeys:font, 
NSFontAttributeName, nil];
     NSDictionary *noteAttrs = [NSDictionary 
dictionaryWithObjectsAndKeys:noteFont, NSFontAttributeName, [NSParagraphStyle 
defaultParagraphStyle], NSParagraphStyleAttributeName, nil];
     NSDictionary *noteTextAttrs = [NSDictionary 
dictionaryWithObjectsAndKeys:noteTextFont, NSFontAttributeName, 
[NSParagraphStyle defaultParagraphStyle], NSParagraphStyleAttributeName, nil];


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