koron / bdf2ttf

Convert BDF font file to TTF (embed bitmap as is, not conver to vector)
MIT License
56 stars 12 forks source link

Help #4

Closed PascalPixel closed 7 years ago

PascalPixel commented 7 years ago
|_ noto.fnt
|   |_ noto.png
|_ noto.bdf

noto_42px.zip

koron commented 7 years ago

What's your problem?

PascalPixel commented 7 years ago

We need a ttf but the software crashes

koron commented 7 years ago

I'm not an esper, please describe details of your problem as possible as you can.

I need these information:

  1. Which environment did you execute bdf2ttf? OS, compiler those name and version.
  2. How do you get executable? If you compile by yourself, describe it.
  3. Then, how do you execute bdf2ttf? please write command and its arguments exactly.
  4. Attach your font.ini file, it was required by bdf2ttf.
  5. Did you get any messages other than crash?
PascalPixel commented 7 years ago

problem

  1. We have a site called www.kanjirpg.com
  2. We want a pixelated font for the Kanji
  3. We used Unifont
  4. Unifont is too small 16x16px and the details are unlearnable
  5. Unifont has Chinese glyphs, not Japanese
  6. We took Noto CJK JP font from Google/Adobe open source
  7. We used a Bitmap converter tool and made a .fnt + .png of the Unified CJK Ideograms field and Katakana and Hiragana in Unicode.

needed

  1. The bitmap font needs to be converted to svg outlines
  2. the svg outlines file needs to be converted to a .ttf or .otf

what we did

  1. We converted the .fnt + .png to .bdf, there is no font.ini output
  2. FontForge crashes when we load the .bdf
  3. We found your repository is the only thing on the internet called bdf2ttf
  4. We can't build your C++ code (mac, xcode) we don't know how the makefile works

notes

koron commented 7 years ago
  1. The bitmap font needs to be converted to svg outlines
  2. the svg outlines file needs to be converted to a .ttf or .otf

bdf2ttf just embeds bitmap glyphs (as bitmap) to ttf. It doesn't convert bitmap to vector (svg like). So you can't use bdf2ttf for your purpose.

PascalPixel commented 7 years ago

If TTF supports bitmap that would be ok! We only need one size :)

koron commented 7 years ago

It may be that generated TTF can't be shown in web browsers, is it ok for you? I have tested those on Windows native apps only (and it was over 10 years ago).

If it is ok for you, please prepare Windows environment and try Windows binary.

koron commented 7 years ago

If you want to execute bdf2ttf on mac, please try make osx at top dir of this project. It will build bdf2ttf's executable file if you have enough toolchains or so. But I can't assure anythings, because it is very very very old.

PascalPixel commented 7 years ago

Thank you @koron! I was able to build the executable after changing all the = parameters to == to turn the assignments into an equality comparisons

You are right I need a .ini file that I don't have.

Do you have a .bdf file and font.ini file that I can use to compare my .fnt xml file to?

koron commented 7 years ago

Please check https://github.com/koron/bdf2ttf/blob/master/sample.ini 👍

PascalPixel commented 7 years ago

Aye I don't think it's working anymore

pixel_noto.zip

Input is 4.4MB but output is 1.4MB and doesn't work

koron commented 7 years ago

It looks like your pixel_noto.bdf is broken and strange. It contains very small glyphs only. For example, this is glyph data for a 0 character, its width is 4 pixels and height is 6 pixels.

STARTCHAR 0030
ENCODING 48
SWIDTH 500 0
DWIDTH 4 0
BBX 4 6 0 0
BITMAP
E0
90
90
90
90
E0
ENDCHAR

And it will be generated as 8 pixel (6 point) font.

Input is 4.4MB but output is 1.4MB

It is not matter. bdf2ttf embedd bitmap glyphs as binary, but bdf has those as text. Generated TTF will be smaller than BDF..

koron commented 7 years ago

And your attached pixel_noto.ttf can be shown by gvim in Windows like this.

01

with this setting.

set gfn=Noto_Sans_CJK_JP_ThinRegularNot:h6:cSHIFTJIS:qDRAFT
PascalPixel commented 7 years ago

Wow it's working with a setting? I guess I won't be able to use the output .ttf as a webfont.

I need to go back and find a way to cut the mapped .fnt and .png into separate images, then convert them to svg, then somehow to an svg font.

Thank you for your help Mr. Esper!

koron commented 7 years ago

I haven't try that but potrace and fontforge might work good for your purpose. Please check it https://fontforge.github.io/autotrace.html