Perfect Fonts - (Source Included)

BlitzMax Forums/BlitzMax Programming/Perfect Fonts - (Source Included)

dw817(Posted 2016) [#1]
.


dw817(Posted 2016) [#2]
.


dw817(Posted 2016) [#3]
While BlitzMAX comes with an on-board system font, it is not really very pretty to look at or use in your programs.



You may have even thought of building your own perfect pixeled font so it would fit the way you want it - and maybe you did.

But I'll bet you also played with the idea of loading and displaying TrueType fonts to see how easy it would be to have in your programs, both monospace and not.

And even with Monospace fonts, unless you did some fancy real number adjustments SetScale X#/TextHeight(),Y#()/TextWidth() you really couldn't get them to fit perfectly on the screen for what you wanted.

Well I thought about it and how useful it would be for game programmers to have a little routine that loads a monospace font and forces it to be 16-pixels across with 32-pixels down spacing.



And - that's just what you have here ! And since you have the source, you can certainly change it to fit any grid size or method you want. It comes on-board with the Truetype font "CPMono," an OpenSource font by TINO MEINERT which is a really lovely set to have in your games and programs.

http://imjustcreative.com/cp-mono-beta-free-typeface-for-immediate-download/2009/06/06

http://www.liquitype.com/works/cpmono-neue/cpmono-neue.html

Enjoi !






Brucey(Posted 2016) [#4]
You should probably attribute the font author (as per its license requirements), since you are embedding it in your code :-)

So your code basically reloads the font until your width is 16?

I doubt anyone would want to do this as part of their application start up.
Why recalculate something like this inefficiently every time when you'd already know the answer and could just hard-code it?

:o)


dw817(Posted 2016) [#5]
Hi Brucey. My program is Freeware, you can use any Font you want. Who made the "CPMono" font ? Hmm ... Someone once told me Google is my friend, you haven't so I will.

http://imjustcreative.com/cp-mono-beta-free-typeface-for-immediate-download/2009/06/06

I guess this guy did and he says it's "Open Source." Not up on my copyright terms, that means free to all, right ? His name is TINO.

Oh, and as for my code, it doesn't have to be 16, it could be 24 or you name it, match it for whatever grid size you want.

Oh and if you're thinking you use: LoadImageFont() and put in a number of 16 thus: fnt=LoadImageFont("cpmono.ttf",16). That doesn't work, the 16 represents the HEIGHT of the font, not the width.

For a long time this confused me and I never could get loaded fonts to line up on a neat grid. This technique works quite well for that.

Now if you guys wanna add an option to BlitzMAX like, LoadImageFontWidth("cpmono.ttf",16) where the 16 is the WIDTH of the widest character, that would definitely save me from all this trouble. :)

But since that command doesn't exist, I personally think that this code is invaluable and will be using it in a future project, "Vector Builder" which lets you build and save to your source, vectored images. Also later projects.


Casaber(Posted 2016) [#6]
Nope A guy called Tino did that font, I mailed the creator earlier today about. For personal use he writes its totally free but I was interested to talk to him as a designer.

Nice taste in fonts. I fell in love at first sight.

I really like the technique of loading, it's actually very elegant.

Any plans for a non-mono-spaced font? I tried to change it to check the height instead of width but it was difficult for some reason.
I tried to do the opposite of hardcoding and tried to make it more general, but I got stuck I did not have much time.
Anyway this is just a size test, it works so fine 2 pixels and up, I really like that.

Tthis is just leaving my desk so it´s not by any means formatted or styled for others. I´ve scribbled some comments for myself to check up later.





dw817(Posted 2016) [#7]
Yep, I googled too and found him, Casaber. And no, I'm not in the business to make money today - none at all. I have all I need. All my works are Freeware. If you're gonna use them in a COMMERCIAL project however, just mention me - little ol' dw817.

I doubt anything I've written thus far posted will merit that kind of attention. :)

As for fonts, I suppose if I had a good Truetype Font Builder, I could make a super legible font of my own and dedicate it for free use-anyway-you-want for BlitzBASIC.com as I have in the past done many MANY fonts on the Apple, IBM (DOS), and Amiga. Here is one I had for early Scenario 2 (GFA).

[IMAGE]

Despite the recent copyright notice, I actually doodled this in my own TileMaster version about 16-years ago. If I could make my own Truetype Font, it would be based on this work.

Trying out your program, OMY ! You move the mouse to the LEFT and you can change the scaling. That's a pretty neat way to see how it works ! You might fudge the shadowing a bit (longer in length for when you scale larger).

As for writing a program to convert ANY Truetype Font to monospace and on a grid, I have that on the blotter. Now you won't be able to use DrawText( fullstring$ ), no, I'll have to write a routine to display them one character at a time and to do a little tiny bit of stre-etch-hing to characters that are really skinny like 1, i, j, and l (el) using a calculation based on the maximum size of all letters.


Derron(Posted 2016) [#8]
"Open Source." Not up on my copyright terms, that means free to all, right ?


"Open Source" does not mean "take it and publish it somewhere else without stating the licence to use it".

This is the original website of the font (and author)
http://www.liquitype.com/works/cpmono-neue/cpmono-neue.html

There is no licence stated. As he seems to made a download available on the website you linked to, I assume he was okay with publishing it for free.
Casaber now wrote, that he allowed it for "personal use".


Open Source = you are allowed to see the sources (if possible)
Public Domain = everybody owns it
Freeware = you are free to use it but sources may be closed
...

It is _really_ a bad habit to not mention the name of an author if you did not do it on your own.


I would suggest to at least mention the author, the website and the "personal use" statement.

'FONT: "CP Mono Beta" by Tino Meinert, Liquitype. Free for personal use.


Ah... before submitting the post I found this.
https://raw.githubusercontent.com/chrissimpkins/codeface/master/fonts/cp-mono/CC_License.txt


bye
Ron


dw817(Posted 2016) [#9]
Thanks, Ron. I want to do this the right way. I already listed his website so let's add this too.

Source has been updated. I included two web links, his full name, his full disclaimer. Do you think we should post his Email address in the code ? If you can get it, I'll do that additionally.

Oh ! And glad you like the code ! Really do appreciate your compliments !


Casaber(Posted 2016) [#10]
dw817 Same here, I've got what I need in life. But I draw alot so I wanted to chat him becuase of that, not about commercial things.

I changed the shadowing, It really turned out really nice. I guess you could improve that many times it's not there to stay there's better algorithms, I just wanted to actually see it with some better shadowing.




dw817(Posted 2016) [#11]
Casaber, could you please post the link so I can write him thanks ? If you think that's too private, you can send it to my publicly listed EMAIL of dw817@.... Let me know when you do though so I can search for it from the SPAM. :)

Thanks !


Casaber(Posted 2016) [#12]
@dw817 I did it right away or else I forget. It has been sent now.


dw817(Posted 2016) [#13]
Really appreciate it, Casaber. One thing I asked is the program he used to develop his font. I'm a bit of an artist in truth, published several sketches, drawings, and paintings to DeviantART.

I don't do much art these days, but would like to take a crack at making my own Truetype font from scratch, especially if it's something the community of BlitzMAX would like to use in their own projects.


Derron(Posted 2016) [#14]
I used
http://www.high-logic.com/font-editor/fontcreator.html
when designing some logo-glyphs for my websites (so I could use the font-functions of PHP to watermark things).

At the end a font editor needs to work nicely with vectors and (bezier) curves. Benefits of the editors might be concerning guides (cap height, meanline, baseline, ...) else it all is a matter of copy-paste "a" to "á" and adding some strokes.

Most important part in font design is the design, not the technics behind.


@sketches, drawings and paintings
Feel free to post your portfolio/link


@font credits
Thanks. Think "Tino" feels better with that, than no licence at all (just think of one seeing your code without credits and copying the font because you PD'd your code...


bye
Ron


dw817(Posted 2016) [#15]
If I make another font as Truetype it'll just be standard ASCII #32 to #127, Ron. I really don't know about all that other stuff, and in any case, my font will likely just be used for GAMES not translation software. :)


dw817(Posted 2016) [#16]
... ??? What is with this board ? I have 3-messages above each other now ? I had that happen once before and I blanked the message once already.