Adding a new font for MeshWriter

bigrig, that is beyond excellent!

I will see if there is a way to get MeshWriter-Font to come up with the right settings out the gate. I reverse-engineered some by pattern-matching out of several font files but I may have missed a turn.

Have fun!

Hi again @TheLeftover.
Loong time! Hey, quick improvement.
I added “id” as a parameter to the options… so that you can have multiple text objects in the same scene (separately addressable / pickable).
id = setOption ( options, "id", isString, id ) ,
on line 186. and then passing it into makeSPS on line 295

Also, if you haven’t seen already, check out: GitHub - ycw/Babylon.Font
Looks neat… you can drop a font file in and it somehow magically renders in that font.

hi TheLeftover, I’m in the same situation. only number worked. Can you look at this file? if you have time.this font is free ,but file is bigger than 4 mb, can you give me an email address? :grinning:

Musk, I am sorry you are having trouble. The symptom of seeing only numbers indicates that index.js is not correctly loading config.js in the same directory. I cannot think of anything else that causes it.

The code in MeshWriter-Font index.js starts by (painfully) looking for what glyphs you want covered. That list eventually goes into an array called ‘coverage’.
~ It first tries to use a coverage array in config.js that matches your font name
~ If no such is found, it tries to use the ‘default-coverage’ in config.js
~ If no such is found, it just does the numerals

Question: Can you capture the screen output from following the instructions found under Convert A File (GitHub - briantbutton/meshwriter-font: Create font files for meshwriter)? The console output may be illuminatory.

P.S. config.js may be found in the repo at meshwriter-font/config.js at master · briantbutton/meshwriter-font · GitHub

@musk, are you still having a problem?

If you are please capture the terminal output. I will take a look. I saw elsewhere that you might be using a Japanese character set. I think the coverage file will still work but the default coverage values certainly will not.

Thank you for your attention,Im really sorry. yes,but i was delayed by something else.I will capture output to you within 24 hours :sweat_smile:

build font js file:

run build out put:

my edit in index.js :
// >>>>> STEP 1 <<<<<
[’./fonts/hirukopro-book’,’./fonts/helveticaneue-medium’,’./fonts/comicsans-normal’,’./fonts/jura-demibold’,’./fonts/webgl-dings’,’./fonts/makinas-flat-5’],
function(HPB,HNM,CSN,JUR,WGD,MAK){
// >>>>> STEP 1 <<<<<

var scene,FONTS,defaultColor,defaultOpac,naturalLetterHeight,curveSampleSize,Γ=Math.floor,hpb,hnm,csn,jur,wgd,mak,debug;
var b128back,b128digits;
var earcut = require("earcut");
prepArray();
// >>>>>  STEP 2 <<<<<
hpb                          = HPB(codeList);
hnm                          = HNM(codeList);                         // Do not remove
csn                          = CSN(codeList);
jur                          = JUR(codeList);
wgd                          = WGD(codeList);
mak                          = MAK(codeList);
// opp                         = OPP(codeList);

// >>>>>  STEP 2 <<<<<
FONTS                        = {};
// >>>>>  STEP 3 <<<<<
FONTS["HirukoPro-Book"]      = hpb;
FONTS["HelveticaNeue-Medium"]= hnm;                                   // Do not remove
FONTS["Helvetica"]           = hnm;
FONTS["Arial"]               = hnm;
FONTS["sans-serif"]          = hnm;
FONTS["Comic"]               = csn;
FONTS["comic"]               = csn;
FONTS["ComicSans"]           = csn;
FONTS["Jura"]                = jur;
FONTS["jura"]                = jur;
FONTS["WebGL-Dings"]         = wgd;
FONTS["Web-dings"]           = wgd;
FONTS["makinas-flat-5"]          = mak;

in babylon:


@musk, that is helpful information.

We must wind back to the steps where you created makinas-flat-5.js. Observe the size, only 4K. So that is not a full complement of glyphs.

You should have earlier created that file using the instructions found under Convert A File (GitHub - briantbutton/meshwriter-font: Create font files for meshwriter)

Can you re-run that and post the console output?

here it is

@musk, this is my fault. MeshWriter Font was not properly reading the config.js file. Thank you for your patience.

I have updated the MeshWriter-Font code on GitHub and also updated the README. Please try again.

If you have your directories already set up, the only new thing you need is ‘index.js’. Replace your current ‘index.js’ with the new one. Leave everything else in place.

Then try again.

The new code index.js should read the config.js properly. It will also PRINT the coverage that it is using. So, if there is a problem in the coverage, you may see it that way.

If you still have a problem, please copy the terminal session and post it here along (like above) and attach your config.js file.

It worked ! Amazing ! Really thank you for your professional work. :+1:

but some words with complex shapes are incomplete , the wrong boundary was identified,It looks like it’s hard to fix

Yes. I see that. Let me suggest the following:
~ Go into ‘makinas-flat-5.js’
~ Look for two flags: reverseShapes and reverseHoles

If you change their values, you will get a different appearance. Try changing them and test the results. There are only four possible combinations. I think one of them will be perfect.

Sorry for the difficulty, MeshWriter-Font tries to get the right values but for some font files, it doesn’t. I would like to hear how this works for you.

That’s true,reverseShapes and reverseHoles both TRUE will get perfect results.Thanks again !