Hi !
Featured games (91)
games approved by the League of Dukes
Games in Showcase (763)
Games in Android Showcase (229)
games submitted by our members
Games in WIP (852)
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 1196 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  

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

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

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

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

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

nelsongames (1058 views)
2018-04-24 18:14:32

ivj94 (1637 views)
2018-03-24 14:47:39

ivj94 (562 views)
2018-03-24 14:46:31

ivj94 (1459 views)
2018-03-24 14:43:53

Solater (567 views)
2018-03-17 05:04:08
Java Gaming Resources
by philfrei
2017-12-05 19:38:37

Java Gaming Resources
by philfrei
2017-12-05 19:37:39

Java Gaming Resources
by philfrei
2017-12-05 19:36:10

Java Gaming Resources
by philfrei
2017-12-05 19:33:10

List of Learning Resources
by elect
2017-03-13 14:05:44

List of Learning Resources
by elect
2017-03-13 14:04:45

SF/X Libraries
by philfrei
2017-03-02 08:45:19

SF/X Libraries
by philfrei
2017-03-02 08:44:05 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!