Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

invalid PostScript font name #1

Closed
sunaku opened this issue Jul 2, 2016 · 9 comments
Closed

invalid PostScript font name #1

sunaku opened this issue Jul 2, 2016 · 9 comments

Comments

@sunaku
Copy link

sunaku commented Jul 2, 2016

Hello,

I tried using bdf2ttf to transform the Tamzen font into TTF, but when I double-click on the resulting TTF file under Windows 7, an error dialog appears saying "Windows Font Viewer: The requested file ... is not a valid font file.". Similarly, I'm getting an error message when opening the resulting TTF file in FontForge under Linux: 😞

FontForge error

In the above screenshot, that "|0003|" Unicode glyph at the end of the font name is suspicious. :suspect:

Steps to reproduce the bug

$ mkdir -p ~/.fonts/tamzen-font

$ git clone https://github.com/sunaku/tamzen-font ~/.fonts/tamzen-font

$ cd ~/.fonts/tamzen-font

$ git checkout bdf2ttf

$ cat ttf/TamzenForPowerline.ini
Fontname = TamzenForPowerline
Version = 1.11.5
Copyright = Copyright
Trademark = Trademark

$ bdf2ttf ttf/TamzenForPowerline-regular.ttf ttf/TamzenForPowerline.ini bdf/TamzenForPowerline*r.bdf
Input files:
  bdf/TamzenForPowerline5x9r.bdf
  bdf/TamzenForPowerline6x12r.bdf
  bdf/TamzenForPowerline7x13r.bdf
  bdf/TamzenForPowerline7x14r.bdf
  bdf/TamzenForPowerline8x15r.bdf
  bdf/TamzenForPowerline8x16r.bdf
  bdf/TamzenForPowerline10x20r.bdf

$ bdf2ttf -b ttf/TamzenForPowerline-bold.ttf ttf/TamzenForPowerline.ini bdf/TamzenForPowerline*b.bdf
Input files:
  bdf/TamzenForPowerline5x9b.bdf
  bdf/TamzenForPowerline6x12b.bdf
  bdf/TamzenForPowerline7x13b.bdf
  bdf/TamzenForPowerline7x14b.bdf
  bdf/TamzenForPowerline8x15b.bdf
  bdf/TamzenForPowerline8x16b.bdf
  bdf/TamzenForPowerline10x20b.bdf

$ fontforge ttf/TamzenForPowerline-regular.ttf
... now observe the error shown in the screenshot above ...

Thanks for your consideration. 😅

@koron
Copy link
Owner

koron commented Jul 3, 2016

I can't reproduce your problem, but get font files attached. Please check this.
TamzenForPowerline.zip
It seems correct font files for me.

I have compiled bdf2ttf by MSVC10's 32bit compiler on WIndows 10,
converted and checked result TTF files on same machine.

@sunaku
Copy link
Author

sunaku commented Jul 3, 2016

Thanks! 👍 Your generated fonts worked successfully in Linux FontForge and Windows 7. 💯

I should have mentioned that I compiled and ran bdf2ttf under Linux, using make gcc target.
So there appears to be some functional difference between the results of MSVC and GCC. 🐛

For your reference, here is my GCC information and compilation output:

$ gcc --version
gcc (GCC) 4.9.3
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ make gcc-clean
make -f compile/Make_gcc.mak clean
make[1]: Entering directory '/home/sunny/lab/bdf2ttf'
rm -f ./src/bdf.o ./src/bdf2ttf.o ./src/main.o ./src/rcfile.o ./src/table.o ./src/ucsconv.o
make[1]: Leaving directory '/home/sunny/lab/bdf2ttf'

$ make gcc
make -f compile/Make_gcc.mak
make[1]: Entering directory '/home/sunny/lab/bdf2ttf'
cc    -c -o src/bdf.o src/bdf.c
g++      -c -o src/bdf2ttf.o src/bdf2ttf.cpp
src/bdf2ttf.cpp:71:1: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
 };
 ^
src/bdf2ttf.cpp:71:1: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
src/bdf2ttf.cpp:71:1: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
src/bdf2ttf.cpp:71:1: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
src/bdf2ttf.cpp:71:1: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
src/bdf2ttf.cpp:71:1: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
src/bdf2ttf.cpp:71:1: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
src/bdf2ttf.cpp:71:1: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
src/bdf2ttf.cpp:71:1: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
src/bdf2ttf.cpp:71:1: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
src/bdf2ttf.cpp:71:1: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
src/bdf2ttf.cpp:71:1: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
src/bdf2ttf.cpp:71:1: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
src/bdf2ttf.cpp:71:1: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
src/bdf2ttf.cpp:71:1: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
src/bdf2ttf.cpp:71:1: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
src/bdf2ttf.cpp:71:1: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
src/bdf2ttf.cpp:71:1: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
src/bdf2ttf.cpp:71:1: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
src/bdf2ttf.cpp:90:30: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
 static char* STYLE_REGULAR = "Regular";
                              ^
src/bdf2ttf.cpp:91:28: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
 static char* STYLE_BOLD  = "Bold";
                            ^
src/bdf2ttf.cpp:92:29: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
 static char* STYLE_ITALIC = "Italic";
                             ^
src/bdf2ttf.cpp:93:33: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
 static char* STYLE_BOLDITALIC = "Bold Italic";
                                 ^
In file included from src/bdf2ttf.cpp:11:0:
src/version.h:12:19: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
 #define COPYRIGHT "(C) 2003 KaoriYa";
                   ^
src/bdf2ttf.cpp:95:21: note: in expansion of macro 'COPYRIGHT'
 char *g_copyright = COPYRIGHT;
                     ^
src/version.h:13:18: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
 #define VERSION  "2.0"
                  ^
src/bdf2ttf.cpp:100:20: note: in expansion of macro 'VERSION'
 char *g_version  = VERSION;
                    ^
src/version.h:14:19: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
 #define TRADEMARK "KaoriYa"
                   ^
src/bdf2ttf.cpp:102:21: note: in expansion of macro 'TRADEMARK'
 char *g_trademark = TRADEMARK;
                     ^
src/bdf2ttf.cpp: In function 'void generate_OS2_PREP(bdf2_t*)':
src/bdf2ttf.cpp:831:35: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
     os2->array::addString(VENDORID); // achVendID
                                   ^
cc    -c -o src/main.o src/main.c
cc    -c -o src/rcfile.o src/rcfile.c
g++      -c -o src/table.o src/table.cpp
cc    -c -o src/ucsconv.o src/ucsconv.c
g++ -o bdf2ttf  src/bdf.o src/bdf2ttf.o src/main.o src/rcfile.o src/table.o src/ucsconv.o
make[1]: Leaving directory '/home/sunny/lab/bdf2ttf'

@koron
Copy link
Owner

koron commented Jul 3, 2016

There seems be bad assumption of bdf2ttf.

bdf2ttf consider unsigned long is 32bit. But most of gcc treat it as 64bit.
It will cause some problems.

@koron
Copy link
Owner

koron commented Jul 3, 2016

It would be better that use size aware types uint32_t or so.
But I don't have time to do that.

@koron
Copy link
Owner

koron commented Jul 3, 2016

I have fixed for gcc.

@sunaku please try again with recent version.

@sunaku
Copy link
Author

sunaku commented Jul 3, 2016

Thanks @koron! 🙇 I tried the fix but the problem still occurs. 😞 I will try to debug it further. 👷

@sunaku
Copy link
Author

sunaku commented Jul 3, 2016

I tried rebuilding bdf2ttf for 32-bit architecture (my system is 64-bit):

$ make gcc CFLAGS=-m32 LDFLAGS=-m32
make -f compile/Make_gcc.mak
make[1]: Entering directory '/home/sunny/lab/bdf2ttf'
cc -m32   -c -o src/bdf.o src/bdf.c
g++  -m32    -c -o src/bdf2ttf.o src/bdf2ttf.cpp
cc -m32   -c -o src/main.o src/main.c
cc -m32   -c -o src/rcfile.o src/rcfile.c
g++  -m32    -c -o src/table.o src/table.cpp
cc -m32   -c -o src/ucsconv.o src/ucsconv.c
g++ -o bdf2ttf  src/bdf.o src/bdf2ttf.o src/main.o src/rcfile.o src/table.o src/ucsconv.o -m32
make[1]: Leaving directory '/home/sunny/lab/bdf2ttf'

I still get the "Postscript font name" error in FontForge 😞 but at least the embedded bitmap fonts appear correctly now 😌 (previously FontForge rendered them as empty, red boxes). 👷 Next idea...

@koron
Copy link
Owner

koron commented Jul 4, 2016

I still get the "Postscript font name" error in FontForge

I won'f fix about this.
Because it is not in bdf2ttf's scope.
But welcome to receive patches.

@sunaku
Copy link
Author

sunaku commented Jul 4, 2016

😅 Fair enough, thanks for your help! 🙇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants