OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Apr 18, 2019 8:43 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 10 posts ] 
Author Message
 Post subject: Rendered font usage
PostPosted: Mon Jan 28, 2019 2:49 pm 
Offline
Member
Member
User avatar

Joined: Fri Feb 17, 2017 4:01 pm
Posts: 352
Location: Ukraine, Bachmut
Yeah, the caption might not reflect the topic well, sorry. :mrgreen: 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?

_________________
future big goal: ANT - NT-like OS for mips, arm and x86.
current smaller goal: efify - UEFI for a couple of boards (mips and arm).


Top
 Profile  
 
 Post subject: Re: Rendered font usage
PostPosted: Mon Jan 28, 2019 4:53 pm 
Offline
Member
Member
User avatar

Joined: Wed Oct 30, 2013 1:57 pm
Posts: 295
Location: Germany
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

_________________
OSDev Discord
vineyard, a x86 OS.


Top
 Profile  
 
 Post subject: Re: Rendered font usage
PostPosted: Mon Jan 28, 2019 5:55 pm 
Offline
Member
Member
User avatar

Joined: Fri Feb 17, 2017 4:01 pm
Posts: 352
Location: Ukraine, Bachmut
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! :mrgreen:
Quote:
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.

_________________
future big goal: ANT - NT-like OS for mips, arm and x86.
current smaller goal: efify - UEFI for a couple of boards (mips and arm).


Top
 Profile  
 
 Post subject: Re: Rendered font usage
PostPosted: Mon Jan 28, 2019 6:32 pm 
Offline
Member
Member
User avatar

Joined: Sat Nov 22, 2014 6:33 pm
Posts: 551
Location: USA
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:

Image

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.


Top
 Profile  
 
 Post subject: Re: Rendered font usage
PostPosted: Mon Jan 28, 2019 7:17 pm 
Offline
Member
Member

Joined: Wed Mar 30, 2011 12:31 am
Posts: 286
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.

_________________
toaruos on github | toaruos.org | gitlab | twitter |


Top
 Profile  
 
 Post subject: Re: Rendered font usage
PostPosted: Sat Feb 02, 2019 10:38 am 
Offline
Member
Member
User avatar

Joined: Mon May 22, 2017 5:56 am
Posts: 46
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?


Top
 Profile  
 
 Post subject: Re: Rendered font usage
PostPosted: Mon Feb 04, 2019 10:02 am 
Offline
Member
Member
User avatar

Joined: Sun Oct 22, 2006 7:01 am
Posts: 2627
Location: Devon, UK
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 :)


Top
 Profile  
 
 Post subject: Re: Rendered font usage
PostPosted: Mon Feb 04, 2019 5:44 pm 
Offline
Member
Member
User avatar

Joined: Thu Oct 13, 2016 4:55 pm
Posts: 260
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


Top
 Profile  
 
 Post subject: Re: Rendered font usage
PostPosted: Tue Feb 05, 2019 2:17 am 
Offline
Member
Member
User avatar

Joined: Mon May 22, 2017 5:56 am
Posts: 46
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.


Top
 Profile  
 
 Post subject: Re: Rendered font usage
PostPosted: Fri Feb 15, 2019 2:23 pm 
Offline
Member
Member
User avatar

Joined: Fri Feb 17, 2017 4:01 pm
Posts: 352
Location: Ukraine, Bachmut
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. :mrgreen:

_________________
future big goal: ANT - NT-like OS for mips, arm and x86.
current smaller goal: efify - UEFI for a couple of boards (mips and arm).


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group