Java-Gaming.org    
Featured games (91)
games approved by the League of Dukes
Games in Showcase (576)
games submitted by our members
Games in WIP (498)
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  
  Scaling fonts with an AffineTransform  (Read 732 times)
0 Members and 1 Guest are viewing this topic.
Offline zingbat

Senior Member




Java games rock!


« Posted 2009-03-08 19:25:23 »

I'm working on a roguelike just for fun, using unicode chars. I want to use the from the block elements page in particular to build dungeon maps:

http://www.unicode.org/charts/PDF/U2580.pdf

the range is U+2596 to U+259F

I know that all characters in this range have the same size so i thought it would be possible to create a 1point size monospaced font (which has the above unicode chars) and then use the deriveFont method in the Font class with an AffineTransform to transform the font to the desirable size in pixels (for example 16 pixels, squared).

The problems i have:

* how to create the affine transform to obtain a font whose bounds match the pixel size?
* characters have non zero descent, how to change the descent to become 0 and put the origin of each character at the lower left corner?
* it's weird but block characters from the monospaced font aren't squares, they are slightly taller, how to determine this aspect ratio to fix it?
* the glyph edges are being anti-aliasied even set rendering hints to no anti-aliasing

Any clues? Thanks in advance.

PS: It looks like on my MacBook the screen resolution is 112dpi and the screen size  is 1280x800 (using an LCD).

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.

xsi3rr4x (18 views)
2014-04-15 18:08:23

BurntPizza (15 views)
2014-04-15 03:46:01

UprightPath (28 views)
2014-04-14 17:39:50

UprightPath (13 views)
2014-04-14 17:35:47

Porlus (29 views)
2014-04-14 15:48:38

tom_mai78101 (54 views)
2014-04-10 04:04:31

BurntPizza (111 views)
2014-04-08 23:06:04

tom_mai78101 (212 views)
2014-04-05 13:34:39

trollwarrior1 (181 views)
2014-04-04 12:06:45

CJLetsGame (187 views)
2014-04-01 02:16:10
List of Learning Resources
by Longarmx
2014-04-08 03:14:44

Good Examples
by matheus23
2014-04-05 13:51:37

Good Examples
by Grunnt
2014-04-03 15:48:46

Good Examples
by Grunnt
2014-04-03 15:48:37

Good Examples
by matheus23
2014-04-01 18:40:51

Good Examples
by matheus23
2014-04-01 18:40:34

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:22:30

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:05:20
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!