Page 1 of 1
Rendered font usage
Posted: Mon Jan 28, 2019 2:49 pm
by zaval
Yeah, the caption might not reflect the topic well, sorry.
I have a silly question, maybe you know the answer on it?
My project doesn't have any font rendering capabilities yet. And for some initial stages of it, I thought about using a bitmap font. For the FW part of the project, this scenario could be the main (and only) one at all. The question is, - can I use a resource (bitmap), produced using an installed font on my PC? From the legal perspective. Is such usage allowed? I open Paint, and create .bmp file with all the needed symbols typed in there in white and black and then I use this as a resource for generating the needed font bitmap on the fly (applying simple transformation) inside of my project. This way, I can have font with any FG and BG color combination. And all that vector font rendering with all the visual improvement technics, have been done on the Windows machine, not by my code. Is this usage legal? The question.
I have no idea, but feel, it's not. I see here at least 2 problems - 1) the font itself, is it free to use it outside of where it was installed? even if my system rasterized it; and 2) - using the result of font rendering with all the technologies applied outside of its intended use. But maybe there are no problems with this, how do you think?
Re: Rendered font usage
Posted: Mon Jan 28, 2019 4:53 pm
by no92
Hi,
Doing this with Paint seems rather silly (no offense, but it has to be said). Maybe you should look to freely licenced bitmap fonts.
uni-vga comes to mind, which has nice Unicode support and is easy to get the 8x16 character bitmaps from (IIRC it ships as BDF, where extracting bitmaps is a breeze).
To answer your question, find out whatever the license of said font is.
Cheers, Leo
Re: Rendered font usage
Posted: Mon Jan 28, 2019 5:55 pm
by zaval
Thanks. But what's silly about preparing such a resource in Paint? it generates for me a well known and easy to work with bmp formatted image, that I can easily transform (for changing colors)*. Better than anything third party. I can (if I can, of course, that's the question) choose a cute font and have it this way being drawn from the very early stages when I only manage to make first steps with the display system (which isn't easy for SBCs due to horrid or absent documentation). It's for an early development stage! And use some cuteness, like Lucida Console, instead of some ugly eyebleeding free things. Skimming over their (lucida creators) license strengthens my feeling, I need to ask them for approval. But it's not all, the "rendered by Windows" part remains unclear too.
* - say, I pick 100 symbols that are enough and prepare a bmp image 24bpp, 12x20px in form of a bmp image that is 12px in width and 2000px in height. it uses 0xffffff for BG and 0x000000 for FG. It's a bitmap from which it's easy to extract a glyph by index (given they are placed accordingly); but also it could be seen as a "mask" for generating a bitmap for any BG/FG combination. Once on init. Such a file is ~70KB only in size. I don't see it stupid.
PS. Ah, I found the place in the license, where they clearly prohibit such a use. F&ck!
4. Rasterized Image formats. You may include non-scalable, raster graphic images of text generated in pixel form from the Fonts, in electronic documents and graphic image files in industry standard raster image formats including JPEG (Joint Photographers' Expert Group), GIF (Graphics Interchange Format), PNG (Portable Network Graphics), non-vector PICT (non-vector Picture), and BMP (Bitmap) formats, provided that the text images cannot be used for word processing, text editing, text composition, or data entry.
Re: Rendered font usage
Posted: Mon Jan 28, 2019 6:32 pm
by BenLunt
First, I don't know why you placed this in the Auto-Delete Forum. Maybe you thought it wasn't worth keeping for future reference. Maybe so. Depends on where it goes, I guess.
Second, due to EFI and recent hardware no longer allowing you to write to 0xB8000 for text output, all OSes, hobby or otherwise, will require at least one (simple) font simply to write to the screen. If you wish to write text to the screen at startup, which most hobby OSes do, you will need a simple, one color font text rendering system. Most of the time, a fixed sized font for this purpose is perfect, so a bitmap font works just fine.
I created a small app that will allow me to create a bitmap of each character along with some information about that particular character.
Here is a screen shot:
I would suggest you do the same.
I use this app and its resulting fonts in the GUI as well, though they are not resizable, i.e.: They are fixed at the size given.
For more complicated factors, resizable fonts, etc., you will need a font rendering engine, a True Type font, or other font engine. They are not easy, nor are they a small task.
Good luck,
Ben
P.S. This app is not available publicly but is available with my book. This app is freely available, with source code, from
the home page.
Re: Rendered font usage
Posted: Mon Jan 28, 2019 7:17 pm
by klange
Seeing as no one's really answered the original question...
As soon as you say "from the legal perspective", where you are becomes very important.
In the United States, Japan, and some other jurisdictions, the designs of fonts are not subject to copyright (but their digital representations as font files are), so you can take an existing font design and represent it in a new form freely even if the original font was a licensed, proprietary design. You may have to do that manually to ensure you're not violating the license of the original file, though.
For everywhere else, there are plenty of fonts out there with liberal open-source style licenses, such as the Deja Vu font collection. You can use these fonts, including transforming them into other formats or modifying glyphs, much like you would open source code.
Additionally, as a followup to Ben's post...
If you're looking for an approach to text rendering that is simpler than implementing a TrueType interpreter (and the accompanying Bezier curve glyph rasterization), but more powerful than plain bitmaps, you may want to look at Signed Distance Fields, which is an approach used in many game engines and can provide scalable, anti-aliased text. You can see some samples of an SDF renderer
here and
here.
Re: Rendered font usage
Posted: Sat Feb 02, 2019 10:38 am
by eekee
Representing a font in BMP isn't silly. Windows first font file format was a series of header+bmp sequences. Plan 9 uses its own image format with a table of character widths appended. You can literally open the font in an image viewer. Actually, it has two file formats, plain-text font files to tell it the line height and inter-line spacing and to map character ranges to 'subfont' files, then the subfonts are the image files I described.
I think klange has it about right legally. I'd stick with fonts with open licenses myself, otherwise it could be awkward if you get contributors in countries with less liberal copyright laws... I think.
I'm guessing this was put in auto-delete by mistake?
Re: Rendered font usage
Posted: Mon Feb 04, 2019 10:02 am
by AJ
BenLunt wrote:First, I don't know why you placed this in the Auto-Delete Forum. Maybe you thought it wasn't worth keeping for future reference. Maybe so. Depends on where it goes, I guess.
Fixed
Re: Rendered font usage
Posted: Mon Feb 04, 2019 5:44 pm
by bzt
zaval wrote:Thanks. But what's silly about preparing such a resource in Paint? it generates for me a well known and easy to work with bmp formatted image, that I can easily transform (for changing colors)*. Better than anything third party.
You should consider the
PSF2 format, which is basically a simple bitmap (used by Linux Console, many fonts available for free, legally). The wiki page has example C code with changing colors, just as you wanted. PSF2 is very similar to an uncompressed .bmp, but better because it may contain a unicode table as well, assigning y coordinates to the unicode characters (therefore the bitmap can contain the glyphs in any order, and more characters can point to the same glyph). The wiki page has example on how to decode the optional unicode table if you want that.
Also, talamus has written
readpsf / writepsf perl scripts which can convert .psf files into .bmp and vice versa. With that you can convert fonts to bitmaps, open them in Paint, or use in your font renderer. You can use Linux Console fonts without any licencing issues, just give credit.
Cheers,
bzt
Re: Rendered font usage
Posted: Tue Feb 05, 2019 2:17 am
by eekee
Now I'm checking out PSF2 format.
I like Plan 9's format because it's designed for remote displays and full Unicode coverage, only the necessary subfonts get sent to the remote display, but I guess that may be a bit advanced for the original topic.
Re: Rendered font usage
Posted: Fri Feb 15, 2019 2:23 pm
by zaval
thanks everyone for valuable answers!
why I put it into auto-delete part? yes, I thought, it's a little bit silly question and that place is the best for it. after all, it's not even about programming, rather legal things, and, as I've said, I considered that solution a quick and dirty one for early stages. Of course, as anybody here, I dream, in future, to implement fully fledged vector font rendering engine.
Re: Rendered font usage
Posted: Fri Aug 02, 2019 2:03 pm
by lmemsm
zaval wrote:
My project doesn't have any font rendering capabilities yet. And for some initial stages of it, I thought about using a bitmap font. For the FW part of the project, this scenario could be the main (and only) one at all. The question is, - can I use a resource (bitmap), produced using an installed font on my PC? From the legal perspective. Is such usage allowed? I open Paint, and create .bmp file with all the needed symbols typed in there in white and black and then I use this as a resource for generating the needed font bitmap on the fly (applying simple transformation) inside of my project. This way, I can have font with any FG and BG color combination. And all that vector font rendering with all the visual improvement technics, have been done on the Windows machine, not by my code. Is this usage legal? The question.
I have no idea, but feel, it's not. I see here at least 2 problems - 1) the font itself, is it free to use it outside of where it was installed? even if my system rasterized it; and 2) - using the result of font rendering with all the technologies applied outside of its intended use. But maybe there are no problems with this, how do you think?
If you want to do this legally, it would be safer to start out with a font that you have a FLOSS style license to use. I believe pdcurses uses a default bitmap for fonts in their SDL implementation. pdcurses is licensed public domain. You may want to start with what they've done and see what you can reuse from their code and resources.
I also have a list of several mono-spaced (and other fonts). Many are TrueType format but some are bitmap. Check the fonts licenses to make sure they coincide with your goals.
https://lmemsm.dreamwidth.org/3889.html
You can also check sites such as Font Squirrel for public domain fonts to use as a starting point. Most public domain fonts only include a small subset of the Unicode characters. Many FLOSS fonts don't support the whole Unicode character set either. How much of the Unicode character set is supported might be a useful factor when deciding which fonts to use. If you eventually decide to consider TrueType font formats, you may want to look at stb_truetype.h.
Re: Rendered font usage
Posted: Sat Aug 03, 2019 3:27 pm
by zaval
thank you for the detailed answer. the font owners answered me and told me I can use their font the way I wanted. let's hope, I formulated it right, they understood it and I understood their answer right as well.
Re: Rendered font usage
Posted: Mon Sep 30, 2019 3:59 pm
by zaval
By the way, Microsoft released a monospace, "coder" font, under terms of OFL, that allows almost everything. At least bundling it with your OS as ttf, no matter for commercial use or not. Cascadia Code, the name is
and here is the link, for those interested, who yet didn't hear about that.
In the hope, the screenshot will be helpful to evaluate the font quickly.