Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (492)
Games in Android Showcase (112)
games submitted by our members
Games in WIP (556)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Q for Trembovetski: Font kerning information  (Read 2504 times)
0 Members and 1 Guest are viewing this topic.
Offline princec

JGO Kernel


Medals: 369
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Posted 2004-01-22 08:53:28 »

Big and important question (to me!) to the Java2D team:

How the hell can I get font kerning (and glyph) information out of a Font? Currently the only way I can do this is by rendering every bloody character of the font next to every other character of the font and measuring the difference between their positions and the expected advance. This is fine for tiny fonts but just try doing it on a 72pt font with 4000 glyphs.

There must be a way to get this kind of font information directly from Java.

Cas Smiley

Offline Matzon

JGO Knight


Medals: 19
Projects: 1


I'm gonna wring your pants!


« Reply #1 - Posted 2004-01-22 09:24:27 »

It would seem you can't, yet...
http://forum.java.sun.com/thread.jsp?thread=421610&forum=20&message=1922881

Offline princec

JGO Kernel


Medals: 369
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #2 - Posted 2004-01-22 10:24:57 »

Err... sh*t.
Well, that's that then :/

Cas Smiley

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Mark Thornton

Senior Member





« Reply #3 - Posted 2004-01-22 10:56:12 »

I'm curious as why you wanted the information. I can't think of an application which would require it .
Offline princec

JGO Kernel


Medals: 369
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #4 - Posted 2004-01-22 13:20:55 »

That's because you don't write character generators for TV Wink

Cas Smiley

Offline javazoid

Junior Member




Where's Flender?


« Reply #5 - Posted 2004-01-23 05:24:56 »

Do you ?

Mik

Offline Mark Thornton

Senior Member





« Reply #6 - Posted 2004-01-23 06:15:24 »

Quote
That's because you don't write character generators for TV Wink

So you want to render for an especially low resolution display and find you need to adjust the kerning. I presume you tried setting the resolution in a FontRenderContext to an appropriate value.
Offline princec

JGO Kernel


Medals: 369
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #7 - Posted 2004-01-23 07:28:51 »

All this has to do with is being able to layout fonts in some unusual ways that Java2D doesn't do fast enough, so I have to do it manually with sprites in OpenGL. To position the sprites correctly though I need to know how pairs of characters kern together, otherwise some text just looks a bit funny.

Cas Smiley

Offline kevglass

JGO Kernel


Medals: 159
Projects: 23
Exp: 18 years


Coder, Trainee Pixel Artist, Game Reviewer


« Reply #8 - Posted 2004-01-23 08:07:18 »

You're not the one responsible for the evil Telewest EPG are you? Wink

Kev

Offline javazoid

Junior Member




Where's Flender?


« Reply #9 - Posted 2004-01-23 10:10:46 »

So, Princec, you're OpenGL'ing to make java2D faster or what ?

Anyway, can you tell me more about your implementation ? Maybe we could team for some project, as I write character generators in java....

For your problem, take a look at the FontMetrics class. It's not that easy anyway, but I manages something by using gliph visualbounds and logicalbounds.
The book "Java 2D API Graphics" by Vincent Hardy has been of great help for me. It's simply the best java2d book around..

Cheers,

Mik

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline swpalmer

JGO Coder




Where's the Kaboom?


« Reply #10 - Posted 2004-01-23 16:15:02 »

Sounds like you are making a fancy animated text generator for video titling that has some cool effects... fly a word on to the screen in 3D one letter at a time.  That sort of thing?
You might want to try posting at javadesktop.org as well.  There are guys from the Java2D team lurking there every so often.

Offline trembovetski

Senior Member




If only I knew what I'm talking about!


« Reply #11 - Posted 2004-01-24 04:23:58 »

Well, I'm not really a font person, but I've forwarded  your question to those unfortunate ones who are..
Doug or Phil are people to ask these questions..
Offline princec

JGO Kernel


Medals: 369
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #12 - Posted 2004-01-24 09:15:11 »

Thanks Smiley Kerning information should be a pretty easy bit of info to add to the existing FontMetrics API:
1  
float getKerning(char a, char b);

returns the kerning between two characters. It's the only bit of usefuil information about fonts that isn't available in the current API. You could most likely squeeze it into Tiger with little to no effort.

About the character generators - well, not just characters, but graphics and stuff too. It's a "slate generator" we've got, and it replaces several Astons and Chyrons and of course it runs on standard PC hardware, using Java and LWJGL (with AWT this time). It's a client/server app that uses RMI. The client GUI can be used to load up slates into a queue where you can stop, start, advance, etc. them like a tape jukebox, and double click to edit them. Not quite a WYSYWIG editor but they didn't have the budget for that Wink

If anyone receives bulletins from APTN you'll be seeing my slates already on an older system installed last year. If you're really lucky you'll spot the Windows Update dialog box appearing over the top of it coz some fool forgot to turn it off!

Cas Smiley

Offline Mark Thornton

Senior Member





« Reply #13 - Posted 2004-01-24 14:59:23 »

Quote
You could most likely squeeze it into Tiger with little to no effort.

I think the cutoff for that has long gone.

Offline princec

JGO Kernel


Medals: 369
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #14 - Posted 2004-01-24 16:58:55 »

Arse! Might get it into 1.5.1 then I suppose.

Cas Smiley

Offline Abuse

JGO Knight


Medals: 12


falling into the abyss of reality


« Reply #15 - Posted 2004-01-24 19:17:24 »

You don't often here the words 'dot release' and 'api change' in the same sentence :-/ (well not when talking about Java atleast ^_^)

Make Elite IV:Dangerous happen! Pledge your backing at KICKSTARTER here! https://dl.dropbox.com/u/54785909/EliteIVsmaller.png
Offline javazoid

Junior Member




Where's Flender?


« Reply #16 - Posted 2004-01-25 08:28:45 »

Princec, your suggestion about kerning is right and welcome.
We also need it for our character generators. Why don't you post an RFE ?

Princec how can you manage the alpha channel with LWJGL ?

Cheers,

Mik

p.s.
What we're doing ?  Check it out at http://www.classx.it (can you read italian ?)

Offline princec

JGO Kernel


Medals: 369
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #17 - Posted 2004-01-25 08:45:56 »

My RFEs are all voting for Structs unfortunately which I see to be the very biggest problem for games developers as it can't be worked around (whereas I can get kerning information ahead-of-time if I'm prepared to wait. Or even write a native DLL to go rummaging around in font files - I don't care at this stage if it's Win32 only as my CG runs on Windows).

Hm, your character generators are a little cheaper than ours Smiley Ours costs £30,000 and doesn't look nearly as flashy Shocked Alpha channel in LWJGL is trivial. Unless you mean the key channel - in which case you're looking at using a 1600x600 screen, Wildcat dualhead output, and two genlocked scan converters. Not exactly elegant but excellent quality and very cheap compared to the competition! (Our hardware in total costs only £6k)

Abuse - I think we can get new API into a dot release provided that none of the existing API changes behaviour, which in the case it doesn't.


Cas Smiley

Offline dougfelt

Junior Newbie




Java Text = Unicode + Layout


« Reply #18 - Posted 2004-01-28 04:55:57 »

Trust Trembovetski and me...  New API never goes into a dot release (well, it might depend on how much influence you wield with Scott...)

Um, I have to admit that the Sun JVM's don't do kerning at all... I expect Apple's does, though I haven't examined their implementation closely.

What are you trying to do with text that the existing text APIs don't do or are too slow at?  Text on a path?  Tightening or loosening the text?  Justification?

Text APIs have to be general enough to support Unicode, then optimized underneath for ASCII or Latin-1.  So for example the API would have to support surrogates.  There's really no API for getting the pure font table information-- not itself so straightforward if you have to support both Type1 and TrueType/OpenType.  You can't even get the font file (if there is one) there are some security issues that would have to be dealt with.  The approach so far has been to just provide higher-level API, and let the real intense folks just pull apart the font data themselves if they have access to it, and have at it.  
Offline oNyx

JGO Coder


Medals: 2


pixels! :x


« Reply #19 - Posted 2004-05-27 01:52:08 »

Sorry for summoning such an old thread Tongue

Well, Cas... how did you get that kerning information then? (I know you did Grin)

I don't really need it right now, because my current game will only have about 30-40 words... but it's good to know how to do that kind of stuff if I ever really need it Smiley

弾幕 ☆ @mahonnaiseblog
Offline princec

JGO Kernel


Medals: 369
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #20 - Posted 2004-05-27 06:55:33 »

Take a look at the SPGL font converter Smiley Brute force, basically...

Cas Smiley

Offline oNyx

JGO Coder


Medals: 2


pixels! :x


« Reply #21 - Posted 2004-05-27 07:31:28 »

Ah... nice.

Guess it's time to take a closer look at the SPGL again Wink

Thanks Smiley

弾幕 ☆ @mahonnaiseblog
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

Nickropheliac (15 views)
2014-08-31 22:59:12

TehJavaDev (23 views)
2014-08-28 18:26:30

CopyableCougar4 (33 views)
2014-08-22 19:31:30

atombrot (41 views)
2014-08-19 09:29:53

Tekkerue (40 views)
2014-08-16 06:45:27

Tekkerue (35 views)
2014-08-16 06:22:17

Tekkerue (25 views)
2014-08-16 06:20:21

Tekkerue (37 views)
2014-08-16 06:12:11

Rayexar (72 views)
2014-08-11 02:49:23

BurntPizza (49 views)
2014-08-09 21:09:32
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!