Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (780)
Games in Android Showcase (233)
games submitted by our members
Games in WIP (856)
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 1257 times)
0 Members and 1 Guest are viewing this topic.
Offline zingbat

Senior Devvie

Medals: 1

Java games rock!

« Posted 2009-03-08 18: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:

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  

hadezbladez (695 views)
2018-11-16 13:46:03

hadezbladez (342 views)
2018-11-16 13:41:33

hadezbladez (677 views)
2018-11-16 13:35:35

hadezbladez (167 views)
2018-11-16 13:32:03

EgonOlsen (2360 views)
2018-06-10 19:43:48

EgonOlsen (2472 views)
2018-06-10 19:43:44

EgonOlsen (1462 views)
2018-06-10 19:43:20

DesertCoockie (2127 views)
2018-05-13 18:23:11

nelsongames (1903 views)
2018-04-24 18:15:36

nelsongames (2570 views)
2018-04-24 18:14:32
Deployment and Packaging
by mudlee
2018-08-22 18:09:50

Java Gaming Resources
by gouessej
2018-08-22 08:19:41

Deployment and Packaging
by gouessej
2018-08-22 08:04:08

Deployment and Packaging
by gouessej
2018-08-22 08:03:45

Deployment and Packaging
by philfrei
2018-08-20 02:33:38

Deployment and Packaging
by philfrei
2018-08-20 02:29:55

Deployment and Packaging
by philfrei
2018-08-19 23:56:20

Deployment and Packaging
by philfrei
2018-08-19 23:54:46 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‑
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!