Revision: 12859
http://sourceforge.net/p/skim-app/code/12859
Author: hofman
Date: 2022-04-24 14:35:33 +0000 (Sun, 24 Apr 2022)
Log Message:
-----------
viewer prefs are in viewer prefs dictionary, not directly in catalog
Modified Paths:
--------------
trunk/PDFDocument_SKExtensions.m
Modified: trunk/PDFDocument_SKExtensions.m
===================================================================
--- trunk/PDFDocument_SKExtensions.m 2022-04-24 14:30:22 UTC (rev 12858)
+++ trunk/PDFDocument_SKExtensions.m 2022-04-24 14:35:33 UTC (rev 12859)
@@ -157,7 +157,6 @@
CGPDFDocumentRef doc = [self documentRef];
CGPDFDictionaryRef catalog = CGPDFDocumentGetCatalog(doc);
const char *pageLayout = NULL;
- const char *direction = NULL;
CGPDFDictionaryRef viewerPrefs = NULL;
NSMutableDictionary *settings = [NSMutableDictionary dictionary];
if (catalog) {
@@ -181,22 +180,23 @@
[settings setObject:[NSNumber numberWithBool:YES]
forKey:@"displaysAsBook"];
}
}
- if (CGPDFDictionaryGetName(catalog, "Direction", &direction)) {
- if (0 == strcmp(direction, "L2R"))
- [settings setObject:[NSNumber numberWithBool:NO]
forKey:@"displaysRTL"];
- else if (0 == strcmp(direction, "R2L"))
- [settings setObject:[NSNumber numberWithBool:YES]
forKey:@"displaysRTL"];
- }
if (CGPDFDictionaryGetDictionary(catalog, "ViewerPreferences",
&viewerPrefs)) {
+ const char *direction = NULL;
const char *viewArea = NULL;
CGPDFBoolean fitWindow = false;
- if (CGPDFDictionaryGetName(catalog, "ViewArea", &viewArea)) {
+ if (CGPDFDictionaryGetName(viewerPrefs, "Direction", &direction)) {
+ if (0 == strcmp(direction, "L2R"))
+ [settings setObject:[NSNumber numberWithBool:NO]
forKey:@"displaysRTL"];
+ else if (0 == strcmp(direction, "R2L"))
+ [settings setObject:[NSNumber numberWithBool:YES]
forKey:@"displaysRTL"];
+ }
+ if (CGPDFDictionaryGetName(viewerPrefs, "ViewArea", &viewArea)) {
if (0 == strcmp(viewArea, "CropBox"))
[settings setObject:[NSNumber
numberWithInteger:kPDFDisplayBoxCropBox] forKey:@"displayBox"];
else if (0 == strcmp(viewArea, "MediaBox"))
[settings setObject:[NSNumber
numberWithInteger:kPDFDisplayBoxMediaBox] forKey:@"displayBox"];
}
- if (CGPDFDictionaryGetBoolean(catalog, "FitWindow", &fitWindow))
+ if (CGPDFDictionaryGetBoolean(viewerPrefs, "FitWindow",
&fitWindow))
[settings setObject:[NSNumber numberWithBool:(BOOL)fitWindow]
forKey:@"fitWindow"];
}
}
@@ -209,6 +209,7 @@
SKLanguageDirections directions =
(SKLanguageDirections){NSLocaleLanguageDirectionLeftToRight,
NSLocaleLanguageDirectionTopToBottom};
if (catalog) {
CGPDFStringRef lang = NULL;
+ CGPDFDictionaryRef viewerPrefs = NULL;
const char *direction = NULL;
if (CGPDFDictionaryGetString(catalog, "Lang", &lang)) {
NSString *language = (NSString *)CGPDFStringCopyTextString(lang);
@@ -227,7 +228,7 @@
directions.characterDirection =
NSLocaleLanguageDirectionTopToBottom;
}
[language release];
- } else if (CGPDFDictionaryGetName(catalog, "Direction", &direction)) {
+ } else if (CGPDFDictionaryGetDictionary(catalog, "ViewerPreferences",
&viewerPrefs) && CGPDFDictionaryGetName(viewerPrefs, "Direction", &direction)) {
if (0 == strcmp(direction, "L2R"))
directions.characterDirection =
kCFLocaleLanguageDirectionLeftToRight;
else if (0 == strcmp(direction, "R2L"))
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