Pages: « 1 2
  Print  
Author Topic: Default Font Glyph  (Read 4374 times)
Offline (Unknown gender) TheExDeus
Reply #15 Posted on: August 08, 2013, 08:56:57 AM

Developer
Joined: Apr 2008
Posts: 1872

View Profile
That is not an "L", the texture is reverse. It seems it maybe could be fixed, but I doubt you wrote the packer to look for space between already packed glyphs. I will try to some packing and texture changes to clean it up later.
Logged
Offline (Unknown gender) ssss
Reply #16 Posted on: August 09, 2013, 06:01:00 PM
Member
Joined: Jun 2013
Posts: 24

View Profile
I think they are generated the same on all systems (or at least platforms). On Windows, for example, everyone should see this:

Enigma plugin asks AWT for a default font in EnigmaWriter.java. I assume logical fonts aren't garanteed to be always the same. Are they? Probably not if msttcorefonts isnt installed on linux.

Code: [Select]
java.awt.Font iF = new java.awt.Font(java.awt.Font.DIALOG,java.awt.Font.PLAIN,12);
Quote
Also, the default font doesn't look so well and because of size and no AA the lines are not straight when they should be (like in X or Y), so we should at least turn AA on.
It looks like you could get AA easily, the plugin just picks a glyph without AA if available:

Code: [Select]
Object aaHints[] = { RenderingHints.VALUE_TEXT_ANTIALIAS_OFF,
RenderingHints.VALUE_TEXT_ANTIALIAS_GASP,RenderingHints.VALUE_TEXT_ANTIALIAS_ON,
RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB };
if (aa < 0 || aa >= aaHints.length) aa = 0;
GlyphVector gv = fnt.createGlyphVector(new FontRenderContext(null,aaHints[aa],
RenderingHints.VALUE_FRACTIONALMETRICS_OFF),String.valueOf(c));
Logged
Offline (Unknown gender) TheExDeus
Reply #17 Posted on: August 10, 2013, 04:49:14 AM

Developer
Joined: Apr 2008
Posts: 1872

View Profile
Well AA is an option in LGM for all fonts, so I didn't think it would be hard to get it. Just that someone should maybe enable it and see if it makes it look any better.
Logged
Offline (Male) Goombert
Reply #18 Posted on: August 10, 2013, 05:08:07 AM

Developer
Location: Cappuccino, CA
Joined: Jan 2013
Posts: 3110

View Profile
TheExDeus come to think of it, you just made me think about something. How is our font antialiasing rendered? Because in the latest LGM I have font anti aliasing enabled.
Logged
I think it was Leonardo da Vinci who once said something along the lines of "If you build the robots, they will make games." or something to that effect.

Offline (Male) Josh @ Dreamland
Reply #19 Posted on: August 10, 2013, 07:21:13 AM

Prince of all Goldfish
Developer
Location: Pittsburgh, PA, USA
Joined: Feb 2008
Posts: 2958

View Profile Email
Well, I thought about it, Harri, and by my algorithm, the largest amount of empty space between packed glyphs is bounded by the difference in dimension of rectangles packed in a given column or row (which I minimize by sorting up front) multiplied by the largest opposite dimension of textures in the next row or column (counter-respectively). In practice, you'll never have room for more than a 2*16 rectangle, anywhere, and that's if the sorting algorithm can do basically nothing to help the situation.

The best thing we could do to optimize space is flip the texture by 90°.
Logged
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble
"I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
Offline (Unknown gender) TheExDeus
Reply #20 Posted on: August 10, 2013, 09:12:39 AM

Developer
Joined: Apr 2008
Posts: 1872

View Profile
Robert, they are just rendered with Java AWT just like normal fonts. You just give it a hint just like ssss shown. And it does work for a while now. The problem is with too tight packing and/or with the drawing code.
Logged
Offline (Male) Goombert
Reply #21 Posted on: August 13, 2013, 05:24:20 PM

Developer
Location: Cappuccino, CA
Joined: Jan 2013
Posts: 3110

View Profile
Hey hey hey you guys, you'll never guess what I discovered. While I was sitting here writing up GMX loading for LGM, I discovered the new GMX format actually stores a .png of each font resource, it looks like the equivalent of drawing a floor/wall with font_get_texture in ENIGMA, just all the characters organized alphabetically on a transparent background. Or just like that font texture a few posts up from mine. Except theirs is white and not black like ours.
Logged
I think it was Leonardo da Vinci who once said something along the lines of "If you build the robots, they will make games." or something to that effect.

Offline (Unknown gender) TheExDeus
Reply #22 Posted on: August 14, 2013, 01:24:38 AM

Developer
Joined: Apr 2008
Posts: 1872

View Profile
Ours is also white. I inverted the colors when posting here so people could actually see it. It must be white for blending to work. So GMS probably just saves the .png texture for some reason instead of the font (which could be copyrighted, so I guess it does make sense).
Logged
Offline (Male) Josh @ Dreamland
Reply #23 Posted on: August 14, 2013, 08:25:16 AM

Prince of all Goldfish
Developer
Location: Pittsburgh, PA, USA
Joined: Feb 2008
Posts: 2958

View Profile Email
/facepalm
Logged
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble
"I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
Offline (Unknown gender) popcade
Reply #24 Posted on: August 16, 2013, 01:12:24 PM

Member
Joined: Aug 2013
Posts: 29

View Profile
May I recommend FreeType as:
1.It works on many platforms.
2.Same result on supported platforms.
3.Use common TTF files
4.Unicode friendly, so you can progress to UTF-8/16 as internal text engine.
5.Acceptable output quality.

You can actually draw FreeType on a frame buffer and grab it as BMP font if you wish.
Logged
Offline (Unknown gender) TheExDeus
Reply #25 Posted on: August 16, 2013, 04:53:21 PM

Developer
Joined: Apr 2008
Posts: 1872

View Profile
Quote
May I recommend FreeType as:
Yes, that is the one we are considering (in this topic refereed to as libttf).
Logged
Pages: « 1 2
  Print