Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Font Converter/Controller/AppDelegate.hh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2020 J.C. Fields (jcfields@jcfields.dev).
* Updated Augsut 2025 by Disky_eth (https://github.com/Diskyeth)
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
Expand All @@ -24,7 +25,7 @@

@interface AppDelegate : NSObject <NSApplicationDelegate>

@property(retain) FileController *fileController;
@property(strong) FileController *fileController;

- (void)openPaths:(NSArray *)paths;

Expand Down
11 changes: 9 additions & 2 deletions Font Converter/Controller/AppDelegate.mm
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,14 @@ - (void)application:(NSApplication *)sender openFiles:(NSArray *)paths {

// handles files received from Services menu
- (void)handleService:(NSPasteboard *)pasteboard userData:(NSString *)userData error:(NSString **)error {
[self openPaths:[pasteboard propertyListForType:NSFilenamesPboardType]];
NSArray *fileURLs = [pasteboard readObjectsForClasses:@[[NSURL class]] options:@{NSPasteboardURLReadingFileURLsOnlyKey: @YES}];
NSMutableArray *filePaths = [NSMutableArray array];

for (NSURL *url in fileURLs) {
[filePaths addObject:[url path]];
}

[self openPaths:filePaths];
[NSApp replyToOpenOrPrint:NSApplicationDelegateReplySuccess];
}

Expand All @@ -84,4 +91,4 @@ - (void)openPaths:(NSArray *)paths {
[self.fileController addFilesToQueue:files];
}

@end
@end
3 changes: 2 additions & 1 deletion Font Converter/Controller/FileController.hh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2020 J.C. Fields (jcfields@jcfields.dev).
* Updated Augsut 2025 by Disky_eth (https://github.com/Diskyeth)
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
Expand All @@ -25,7 +26,7 @@ NS_ASSUME_NONNULL_BEGIN

@interface FileController : NSObject

@property(retain) NSMutableArray *fonts;
@property(strong) NSMutableArray *fonts;

- (void)addFilesToQueue:(NSArray *)files;
- (void)addFontToQueue:(Font *)font row:(NSUInteger)row;
Expand Down
3 changes: 2 additions & 1 deletion Font Converter/Controller/PreferencesViewController.hh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2020 J.C. Fields (jcfields@jcfields.dev).
* Updated Augsut 2025 by Disky_eth (https://github.com/Diskyeth)
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
Expand All @@ -25,7 +26,7 @@ NS_ASSUME_NONNULL_BEGIN

@interface PreferencesViewController : NSViewController

@property(retain) Preferences *preferences;
@property(strong) Preferences *preferences;

@property(weak) IBOutlet NSPopUpButton *outputFormatPopUp;
@property(weak) IBOutlet NSButtonCell *moveToTrashCheckbox;
Expand Down
9 changes: 5 additions & 4 deletions Font Converter/Controller/ViewController.hh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2020 J.C. Fields (jcfields@jcfields.dev).
* Updated Augsut 2025 by Disky_eth (https://github.com/Diskyeth)
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
Expand All @@ -26,10 +27,10 @@

@interface ViewController : NSViewController <NSTableViewDataSource, NSTableViewDelegate>

@property(retain) FileController *fileController;
@property(retain) NSMutableArray *rows;
@property(nonatomic, retain) NSIndexSet *selectedIndexes;
@property(nonatomic, retain) NSArray *selectedItems;
@property(strong) FileController *fileController;
@property(strong) NSMutableArray *rows;
@property(nonatomic, strong) NSIndexSet *selectedIndexes;
@property(nonatomic, strong) NSArray *selectedItems;
@property(weak) IBOutlet NSArrayController *arrayController;
@property(weak) IBOutlet NSTableView *tableView;

Expand Down
11 changes: 7 additions & 4 deletions Font Converter/Controller/ViewController.mm
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ - (void)viewDidLoad {
tableColumn.sortDescriptorPrototype = sortDescriptor;
}

[self.tableView registerForDraggedTypes:@[NSFilenamesPboardType]];
[self.tableView registerForDraggedTypes:@[NSPasteboardTypeFileURL]];
[self.tableView setDraggingSourceOperationMask:NSDragOperationEvery forLocal:NO];
self.tableView.allowsMultipleSelection = YES;
}
Expand Down Expand Up @@ -93,15 +93,18 @@ - (void)receiveNotification:(NSNotification *)notification {
}

- (void)processQueue {
for (Font *font in [self.fileController fonts]) {
// Create a snapshot of fonts to avoid race conditions
NSArray *fontsSnapshot = [[self.fileController fonts] copy];

for (Font *font in fontsSnapshot) {
// processes queue items asynchronously
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
if ([font status] == kStatusIncomplete) {
[font convertFormat];
}

// reloads table data after processing done
dispatch_sync(dispatch_get_main_queue(), ^{
dispatch_async(dispatch_get_main_queue(), ^{
[self reloadData];
[self validateToolbar];
});
Expand Down Expand Up @@ -339,4 +342,4 @@ - (void)tableView:(NSTableView *)tableView sortDescriptorsDidChange:(NSArray *)s
[tableView reloadData];
}

@end
@end
1 change: 1 addition & 0 deletions Font Converter/Controller/WindowController.hh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2020 J.C. Fields (jcfields@jcfields.dev).
* Updated Augsut 2025 by Disky_eth (https://github.com/Diskyeth)
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
Expand Down
7 changes: 4 additions & 3 deletions Font Converter/Model/ConvertedFont.hh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2020 J.C. Fields (jcfields@jcfields.dev).
* Updated Augsut 2025 by Disky_eth (https://github.com/Diskyeth)
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
Expand All @@ -25,10 +26,10 @@ NS_ASSUME_NONNULL_BEGIN

@interface ConvertedFont : NSObject

@property(retain) NSURL *originalURL;
@property(retain) NSURL *convertedURL;
@property(strong) NSURL *originalURL;
@property(strong) NSURL *convertedURL;
@property(assign) NSUInteger convertedSize;
@property(retain) NSData *contents;
@property(strong) NSData *contents;
@property(assign) NSUInteger format;

- (instancetype)initWithURL:(NSURL *)URL contents:(NSData *)contents format:(NSUInteger)format;
Expand Down
5 changes: 3 additions & 2 deletions Font Converter/Model/Font.hh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2020 J.C. Fields (jcfields@jcfields.dev).
* Updated Augsut 2025 by Disky_eth (https://github.com/Diskyeth)
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
Expand Down Expand Up @@ -51,14 +52,14 @@ FOUNDATION_EXPORT NSArray *const kFileFormats;

@interface Font : NSObject <NSPasteboardReading>

@property(retain) NSURL *URL;
@property(strong) NSURL *URL;
@property(assign) NSUInteger size;
@property(assign) float ratio;
@property(assign) NSUInteger format;
@property(assign) NSUInteger status;
@property(copy) NSString *familyName;
@property(assign) NSUInteger traits;
@property(retain) NSMutableArray *products;
@property(strong) NSMutableArray *products;

- (instancetype)initWithURL:(NSURL *)URL;
- (BOOL)convertFormat;
Expand Down
3 changes: 2 additions & 1 deletion Font Converter/Model/Preferences.hh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2020 J.C. Fields (jcfields@jcfields.dev).
* Updated Augsut 2025 by Disky_eth (https://github.com/Diskyeth)
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
Expand All @@ -25,7 +26,7 @@ NS_ASSUME_NONNULL_BEGIN

@interface Preferences : NSObject

@property(retain) NSUserDefaults *defaults;
@property(strong) NSUserDefaults *defaults;
@property(assign) NSUInteger outputFormat;
@property(assign) BOOL moveToTrash;
@property(assign) BOOL useTabs;
Expand Down
3 changes: 2 additions & 1 deletion Font Converter/Model/TableRow.hh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2020 J.C. Fields (jcfields@jcfields.dev).
* Updated Augsut 2025 by Disky_eth (https://github.com/Diskyeth)
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
Expand All @@ -25,7 +26,7 @@ NS_ASSUME_NONNULL_BEGIN

@interface TableRow : NSObject

@property(retain) Font *font;
@property(strong) Font *font;
@property(weak, readonly) NSString *name;
@property(assign, readonly) NSUInteger size;
@property(weak, readonly) NSString *format;
Expand Down
1 change: 1 addition & 0 deletions Font Converter/Model/WOFF2Converter.hh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2020 J.C. Fields (jcfields@jcfields.dev).
* Updated Augsut 2025 by Disky_eth (https://github.com/Diskyeth)
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
Expand Down
1 change: 1 addition & 0 deletions Font Converter/Model/WOFFConverter.hh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2020 J.C. Fields (jcfields@jcfields.dev).
* Updated Augsut 2025 by Disky_eth (https://github.com/Diskyeth)
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
Expand Down
1 change: 1 addition & 0 deletions Font Converter/Support/main.m
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2020 J.C. Fields (jcfields@jcfields.dev).
* Updated Augsut 2025 by Disky_eth (https://github.com/Diskyeth)
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
Expand Down