Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 11:20 01 Aug 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Maximum font size?

Author Message
MustardMan

Senior Member

Joined: 30/08/2019
Location: Australia
Posts: 175
Posted: 09:55pm 14 Nov 2020
Copy link to clipboard 
Print this post

I would like to create a custom font to display probably four or five large, single colour images (ie: 4 or 5 characters).

A font is defined such (pseudocode):
DefineFont #n
 aabbccdd xxxxxxxx ...
End DefineFont
where aa = number of characters, bb = first character, cc = height, dd = width

which implies a maximum character size of 256x256 pixels.

FontTweak (to my knowledge) won't allow fonts anywhere near this big, so I was wondering if there was a size limit other than the sort-of-implied 256?

Cheers,
Edited 2020-11-15 08:08 by MustardMan
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6283
Posted: 10:08pm 14 Nov 2020
Copy link to clipboard 
Print this post

FontTweak has a sanity check which stops you creating fonts that large but it will open and allow you to edit them if required.

The biggest I have tried is 240 x 64

Jim
VK7JH
MMedit
 
MustardMan

Senior Member

Joined: 30/08/2019
Location: Australia
Posts: 175
Posted: 12:42am 15 Nov 2020
Copy link to clipboard 
Print this post

Hi Jim,

Thanks for the quick reply! I wonder what you guys do all day - it seems whenever something is posted, everyone is onto it straight away! I wish I had time for that  

Using FontTweak I can open my bitmap (256x256) which it then defaults to import at 79x92, then double size and re-import, giving a size of 158x184. I think that will look quite nice.

When I was creating my font I noticed that adding a character (^N) duplicated the first character into the second (or was that the other way around?). Anyway it was not a big deal as once I noticed that I just created a font with everything empty, then went through and filled in the correct symbols.

Cheers,

Edit: It would appear the initial size  (79x92) was simply because that was the last font size I edited and had nothing to do with the imported bitmap size. Unusual size... would have expected multiples of 8...
Edited 2020-11-15 12:46 by MustardMan
 
jirsoft

Guru

Joined: 18/09/2020
Location: Czech Republic
Posts: 533
Posted: 09:43am 16 Nov 2020
Copy link to clipboard 
Print this post

Hi,
for playing with the fonts, you can modify my simple app, I used it for the creating the font for Napoleon Commander from Atari ST bitmap>
OPTION DEFAULT NONE
OPTION EXPLICIT
OPTION BASE 0

CONST INP.FNT = "AtariST.BMP"   'input file name
CONST OUT.FNT = "AtariST.FNT"   'output file name
CONST CHR_W.FNT = 8             'char width in pixels
CONST CHR_H.FNT = 16            'char height in pixels
CONST BMP_W.FNT = 128           'BMP width in pixels
CONST TOPLEFT.FNT = 32          'first char read from BMP
CONST BOTRIGHT.FNT = 255        'last char read from BMP
CONST FIRST.FNT = 32            'ACII of first char
CONST INVERT.FNT = 1            '0=WHITE on BLACK, 1=BLACK on WHITE (can be used to invert font)

convChar

END
SUB convChar
 LOCAL INTEGER ww = BMP_W.FNT / CHR_W.FNT
 LOCAL INTEGER hh = 32/CHR_W.FNT
 LOCAL INTEGER x, y
 LOCAL INTEGER xx, yy, col, bright, b, ch, cpl = 0
 LOCAL STRING h = ""

 LOAD BMP INP.FNT

 OPEN OUT.FNT FOR OUTPUT AS #1
 ?#1,"DefineFont #8"
 ?#1,"  "HEX$(BOTRIGHT.FNT-TOPLEFT.FNT+1,2)HEX$(FIRST.FNT,2)HEX$(CHR_H.FNT,2)HEX$(CHR_W.FNT,2)
 ?#1,"  ";

 FOR ch =TOPLEFT.FNT TO BOTRIGHT.FNT
   x = (ch MOD ww) * CHR_W.FNT
   y = (ch\ww) * CHR_H.FNT
   FOR yy=0 TO CHR_H.FNT-1
     b = 0
     FOR xx=0 TO CHR_W.FNT-1
       col = PIXEL(x + xx, y + yy)
       bright = ((col AND &hFF0000) >> 16) + ((col AND &hFF00) >> 8) + (col AND &hFF)
       IF INVERT.FNT THEN
         IF bright < 382 THEN
           b = b + 2^(CHR_W.FNT - xx - 1)
           PIXEL x + xx, y + yy, RGB(RED)
         ENDIF
       ELSE
         IF bright > 382 THEN
           b = b + 2^(CHR_W.FNT - xx -1)
           PIXEL x + xx, y + yy, RGB(RED)
         ENDIF
       ENDIF
     NEXT xx
     h = HEX$(b,2) + h
     IF LEN(h) = 8 THEN
       ?#1,h" ";
       h = ""
       cpl = cpl + 1
       IF cpl = 8 THEN
         IF ch < BOTRIGHT.FNT THEN
           ?#1
           ?#1,"  ";
         ENDIF
         cpl = 0
       ENDIF
     ENDIF
   NEXT yy
 NEXT ch
 ?#1
 ?#1,"END DefineFont"
 CLOSE #1
END SUB

Jiri
Napoleon Commander and SimplEd for CMM2 (GitHub),  CMM2.fun
 
jirsoft

Guru

Joined: 18/09/2020
Location: Czech Republic
Posts: 533
Posted: 09:43am 16 Nov 2020
Copy link to clipboard 
Print this post

Double post...
Edited 2020-11-16 19:43 by jirsoft
Jiri
Napoleon Commander and SimplEd for CMM2 (GitHub),  CMM2.fun
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025