Revision: 16312
          http://sourceforge.net/p/skim-app/code/16312
Author:   hofman
Date:     2026-05-25 09:37:13 +0000 (Mon, 25 May 2026)
Log Message:
-----------
pass container size

Modified Paths:
--------------
    trunk/QuickLook-Skim/GenerateThumbnailForURL.m
    trunk/SkimQuickLookThumbnails/SKThumbnailProvider.m

Modified: trunk/QuickLook-Skim/GenerateThumbnailForURL.m
===================================================================
--- trunk/QuickLook-Skim/GenerateThumbnailForURL.m      2026-05-25 09:32:57 UTC 
(rev 16311)
+++ trunk/QuickLook-Skim/GenerateThumbnailForURL.m      2026-05-25 09:37:13 UTC 
(rev 16312)
@@ -45,12 +45,12 @@
 static const CGFloat _verticalMargin = 20;
 
 // creates a new NSTextStorage/NSLayoutManager/NSTextContainer system suitable 
for drawing in a thread
-static NSTextStorage *createTextStorage()
+static NSTextStorage *createTextStorage(NSSize size)
 {
     NSTextStorage *textStorage = [[NSTextStorage alloc] init];
     NSLayoutManager *lm = [[NSLayoutManager alloc] init];
     NSTextContainer *tc = [[NSTextContainer alloc] init];
-    [tc setContainerSize:NSMakeSize(_paperSize.width - 2 * _horizontalMargin, 
_paperSize.height - 2 * _verticalMargin)];
+    [tc setContainerSize:size];
     [lm addTextContainer:tc];
     // don't let the layout manager use its threaded layout (see header)
     [lm setBackgroundLayoutEnabled:NO];
@@ -65,7 +65,8 @@
 {
     CGContextRef ctxt = [[NSGraphicsContext currentContext] CGContext];
     
-    NSTextStorage *textStorage = createTextStorage();
+    NSRect stringRect = NSMakeRect(0, 0, _paperSize.width - 2 * 
_horizontalMargin, _paperSize.height - 2 * _verticalMargin);
+    NSTextStorage *textStorage = createTextStorage(stringRect.size);
     [textStorage beginEditing];
     [textStorage setAttributedString:attrString];
     
@@ -87,7 +88,6 @@
     NSTextContainer *tc = [[lm textContainers] objectAtIndex:0];
     
     // we now have a properly flipped graphics context, so force layout and 
then draw the text
-    NSRect stringRect = NSMakeRect(0, 0, _paperSize.width - 2 * 
_horizontalMargin, _paperSize.height - 2 * _verticalMargin);
     NSRange glyphRange = [lm glyphRangeForBoundingRect:stringRect 
inTextContainer:tc];
     stringRect = [lm usedRectForTextContainer:tc];
     

Modified: trunk/SkimQuickLookThumbnails/SKThumbnailProvider.m
===================================================================
--- trunk/SkimQuickLookThumbnails/SKThumbnailProvider.m 2026-05-25 09:32:57 UTC 
(rev 16311)
+++ trunk/SkimQuickLookThumbnails/SKThumbnailProvider.m 2026-05-25 09:37:13 UTC 
(rev 16312)
@@ -49,12 +49,12 @@
 static const CGFloat _verticalMargin = 20;
 
 // creates a new NSTextStorage/NSLayoutManager/NSTextContainer system suitable 
for drawing in a thread
-static NSTextStorage *createTextStorage()
+static NSTextStorage *createTextStorage(NSSize size)
 {
     NSTextStorage *textStorage = [[NSTextStorage alloc] init];
     NSLayoutManager *lm = [[NSLayoutManager alloc] init];
     NSTextContainer *tc = [[NSTextContainer alloc] init];
-    [tc setContainerSize:NSMakeSize(_paperSize.width - 2 * _horizontalMargin, 
_paperSize.height - 2 * _verticalMargin)];
+    [tc setContainerSize:size];
     [lm addTextContainer:tc];
     // don't let the layout manager use its threaded layout (see header)
     [lm setBackgroundLayoutEnabled:NO];
@@ -67,7 +67,8 @@
 
 static void drawAttributedStringInContext(CGContextRef context, 
NSAttributedString *attrString)
 {
-    NSTextStorage *textStorage = createTextStorage();
+    NSRect stringRect = NSMakeRect(0, 0, _paperSize.width - 2 * 
_horizontalMargin, _paperSize.height - 2 * _verticalMargin);
+    NSTextStorage *textStorage = createTextStorage(stringRect.size);
     [textStorage beginEditing];
     [textStorage setAttributedString:attrString];
     
@@ -84,7 +85,6 @@
     NSTextContainer *tc = [[lm textContainers] objectAtIndex:0];
     
     // we now have a properly flipped graphics context, so force layout and 
then draw the text
-    NSRect stringRect = NSMakeRect(0, 0, _paperSize.width - 2 * 
_horizontalMargin, _paperSize.height - 2 * _verticalMargin);
     NSRange glyphRange = [lm glyphRangeForBoundingRect:stringRect 
inTextContainer:tc];
     stringRect = [lm usedRectForTextContainer:tc];
     

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



_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to