Closed ghost closed 6 years ago
This rocks :) thanks ! I'll take a look
@lautr3k : overall super good :) !
As discussed yesterday Only change that would be important is having the actual text/string as a seperate parameter not part of the options ie
text(options, textString)
const t1 = text({font: f1 }, 'OpenJSCAD')
Something else I thought of today while taking another look at your PR:
What are the default options? The function should return something meaningful for simple cases.
Default font size is 10 if not set in options.height
For the default font, I will use vector_text() as fallback
That sounds reasonable. Just wondering, is there a better “vector” font available? Could another default font be created? Or found? The current vector font is very limited.
@z3dev limited in terms of what? number of characters supported? encoding?
The number of supported characters is limited. And it’s really not meant to be rendered at another font size, style, etc.
Can the vector font be removed?
Maybe a default font isn’t necessary. Fonts are pretty easy to locate and down load. We could also supply links to some good ones, like the one used to make the JSCAD logo.
What’s are the steps to use a font? URL? Download? Installation?
web -> drag/drop fonts files then var myFont = include('myFont.ttf')
desktop -> local fonts can be used or drag/drop
Sounds really easy. Also, there's a huge list of fonts already available.
So... Can does HTML / CSS standard specify a standard font? One that every OS / Browser must have?
Look like fonts are located by family. Does opentype.js support this feature?
No, opentype need a font file to work.
Hmm... not so trival then. Should we include a single font file as part of the library?
@lautr3k General question... we need a few more eyes for reviews and opinions for design questions... can we ask (you) for reviews / comments when relevant?
Of course, feel free to ask. But note that I have already started another refactoring of the textes functions in another branch. I rushed on that one and mixed too much stuff at once. I would like to do it again in two stages (PR):
1 - Refactoring of vector_char()
& vector_text()
: options first, font-size, line-height, letter-spacing, optimization.
2 - Add the text()
function
@lautr3k Feel free to rework the PR. I like the ambitious goals. If you need to close this one then please do.
Thanks again!
@lautr3k Any issues with the new PR? I'm looking forward to playing with the new functionalty.
EDIT: font() et include() implemented in https://github.com/lautr3k/OpenJSCAD.org/tree/feature/text()