if compiled for MacOS - use the Mac path separator to get the base file name - don't append .ttf if no dot in the file name (plus small typo fix and error message enhancement)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
diff --git a/demos/src/ftlint.c b/demos/src/ftlint.c
index 0dc3926..3a5ff0e 100644
--- a/demos/src/ftlint.c
+++ b/demos/src/ftlint.c
@@ -97,17 +97,22 @@
strncpy( filename, fname, 128 );
strncpy( alt_filename, fname, 128 );
+#ifndef macintosh
if ( i >= 0 )
{
strncpy( filename + strlen( filename ), ".ttf", 4 );
strncpy( alt_filename + strlen( alt_filename ), ".ttc", 4 );
}
-
+#endif
i = strlen( filename );
fname = filename;
while ( i >= 0 )
+#ifndef macintosh
if ( filename[i] == '/' || filename[i] == '\\' )
+#else
+ if ( filename[i] == ':' )
+#endif
{
fname = filename + i + 1;
i = -1;
@@ -122,9 +127,9 @@
if (error)
{
if (error == FT_Err_Invalid_File_Format)
- printf( "unknow format\n" );
+ printf( "unknown format\n" );
else
- printf( "could not find/open file\n" );
+ printf( "could not find/open file (error: %d)\n", error );
continue;
}
if (error) Panic( "Could not open file" );