Gameboy Development Forum

Discussion about software development for the old-school Gameboys, ranging from the "Gray brick" to Gameboy Color
(Launched in 2008)

You are not logged in.

Ads

#1 2015-05-31 09:39:20

wolfboyft
Member
Registered: 2015-02-02
Posts: 10

Fonts aren't working...? I used 8x8 pixel rom font editor

So... I have a header file...


// Font: font.pf

unsigned char font[2048] =
{
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 000 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 001 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 002 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 003 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 004 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 005 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 006 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 007 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 008 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 009 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 010 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 011 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 012 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 013 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 014 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 015 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 016 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 017 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 018 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 019 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 020 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 021 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 022 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 023 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 024 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 025 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 026 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 027 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 028 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 029 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 030 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 031 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 032 ( )
    0x18, 0x3C, 0x3C, 0x18, 0x18, 0x00, 0x18, 0x18,    // Char 033 (!)
    0x12, 0x12, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 034 (")
    0x66, 0x66, 0xFF, 0x66, 0x66, 0xFF, 0x66, 0x66,    // Char 035 (#)
    0x08, 0x3E, 0x28, 0x3E, 0x0A, 0x0A, 0x3E, 0x08,    // Char 036 ($)
    0x04, 0x64, 0x68, 0x08, 0x10, 0x16, 0x26, 0x20,    // Char 037 (%)
    0x30, 0x48, 0x28, 0x10, 0x2A, 0x44, 0x4A, 0x31,    // Char 038 (&)
    0x08, 0x08, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 039 (')
    0x1C, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x1C,    // Char 040 (()
    0x38, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x38,    // Char 041 ())
    0x00, 0x00, 0x24, 0x18, 0x18, 0x24, 0x00, 0x00,    // Char 042 (*)
    0x00, 0x18, 0x18, 0x7E, 0x7E, 0x18, 0x18, 0x00,    // Char 043 (+)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x08,    // Char 044 (,)
    0x00, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00,    // Char 045 (-)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18,    // Char 046 (.)
    0x04, 0x04, 0x08, 0x08, 0x10, 0x10, 0x20, 0x20,    // Char 047 (/)
    0x3C, 0x66, 0x6E, 0x6E, 0x76, 0x76, 0x66, 0x3C,    // Char 048 (0)
    0x18, 0x3C, 0x6C, 0x4C, 0x0C, 0x0C, 0x1C, 0x7F,    // Char 049 (1)
    0x1E, 0x22, 0x06, 0x0E, 0x1C, 0x38, 0x70, 0x7E,    // Char 050 (2)
    0x3E, 0x02, 0x06, 0x0C, 0x1C, 0x06, 0x6E, 0x3C,    // Char 051 (3)
    0x08, 0x1C, 0x2C, 0x4C, 0x7F, 0x0C, 0x0C, 0x0C,    // Char 052 (4)
    0x3C, 0x20, 0x20, 0x3C, 0x26, 0x06, 0x66, 0x3C,    // Char 053 (5)
    0x38, 0x44, 0x44, 0x70, 0x78, 0x64, 0x64, 0x38,    // Char 054 (6)
    0x7E, 0x46, 0x0C, 0x18, 0x3E, 0x18, 0x18, 0x18,    // Char 055 (7)
    0x3C, 0x66, 0x76, 0x3C, 0x2C, 0x66, 0x76, 0x3C,    // Char 056 (8)
    0x1C, 0x24, 0x24, 0x1C, 0x04, 0x04, 0x04, 0x04,    // Char 057 (9)
    0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18,    // Char 058 (:)
    0x18, 0x18, 0x00, 0x00, 0x00, 0x18, 0x18, 0x08,    // Char 059 (;)
    0x0C, 0x10, 0x20, 0x40, 0x20, 0x10, 0x0C, 0x00,    // Char 060 (<)
    0x00, 0x00, 0x00, 0x3C, 0x00, 0x3C, 0x00, 0x00,    // Char 061 (=)
    0x30, 0x08, 0x04, 0x02, 0x04, 0x08, 0x30, 0x00,    // Char 062 (>)
    0x3C, 0x66, 0x66, 0x0C, 0x18, 0x00, 0x18, 0x18,    // Char 063 (?)
    0x00, 0x38, 0x44, 0x92, 0xAA, 0x9C, 0x41, 0x3E,    // Char 064 (@)
    0x18, 0x3C, 0x66, 0x66, 0x7E, 0x66, 0x66, 0x66,    // Char 065 (A)
    0x38, 0x64, 0x64, 0x68, 0x7C, 0x62, 0x76, 0x3C,    // Char 066 (B)
    0x1C, 0x3A, 0x30, 0x30, 0x30, 0x30, 0x3A, 0x1C,    // Char 067 (C)
    0x78, 0x6C, 0x64, 0x64, 0x64, 0x64, 0x6C, 0x78,    // Char 068 (D)
    0x7C, 0x60, 0x60, 0x7C, 0x7C, 0x60, 0x60, 0x7C,    // Char 069 (E)
    0x7C, 0x7C, 0x60, 0x60, 0x7C, 0x60, 0x60, 0x60,    // Char 070 (F)
    0x1C, 0x3A, 0x30, 0x30, 0x36, 0x32, 0x3A, 0x1C,    // Char 071 (G)
    0x66, 0x66, 0x66, 0x66, 0x7E, 0x66, 0x66, 0x66,    // Char 072 (H)
    0x7E, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x7E,    // Char 073 (I)
    0x3E, 0x0C, 0x0C, 0x0C, 0x4C, 0x4C, 0x6C, 0x38,    // Char 074 (J)
    0x60, 0x62, 0x64, 0x68, 0x70, 0x78, 0x6C, 0x66,    // Char 075 (K)
    0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x3E,    // Char 076 (L)
    0x66, 0x7E, 0x5A, 0x5A, 0x42, 0x42, 0x42, 0x42,    // Char 077 (M)
    0xC2, 0xE2, 0xF2, 0xDA, 0xCE, 0xC6, 0xC2, 0xC2,    // Char 078 (N)
    0x3C, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3C,    // Char 079 (O)
    0x7C, 0x66, 0x62, 0x62, 0x7C, 0x60, 0x60, 0x60,    // Char 080 (P)
    0x3C, 0x66, 0x66, 0x66, 0x76, 0x6E, 0x3C, 0x06,    // Char 081 (Q)
    0x7C, 0x66, 0x62, 0x62, 0x7C, 0x78, 0x6C, 0x66,    // Char 082 (R)
    0x3C, 0x66, 0x62, 0x38, 0x1C, 0x46, 0x66, 0x3C,    // Char 083 (S)
    0x7E, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,    // Char 084 (T)
    0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3C,    // Char 085 (U)
    0xC1, 0xC1, 0x62, 0x62, 0x34, 0x34, 0x34, 0x18,    // Char 086 (V)
    0x81, 0x81, 0x81, 0x81, 0xDB, 0xDB, 0x7E, 0x66,    // Char 087 (W)
    0xC3, 0xC3, 0x66, 0x3C, 0x3C, 0x66, 0xC3, 0xC3,    // Char 088 (X)
    0x23, 0x23, 0x23, 0x13, 0x0E, 0x0C, 0x18, 0x30,    // Char 089 (Y)
    0x7E, 0x06, 0x0E, 0x1C, 0x38, 0x70, 0x60, 0x7E,    // Char 090 (Z)
    0x3C, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x3C,    // Char 091 ([)
    0x20, 0x20, 0x10, 0x10, 0x08, 0x08, 0x04, 0x04,    // Char 092 (\)
    0x3C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x3C,    // Char 093 (])
    0x00, 0x10, 0x28, 0x28, 0x00, 0x00, 0x00, 0x00,    // Char 094 (^)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7E, 0x7E,    // Char 095 (_)
    0x10, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 096 (`)
    0x00, 0x00, 0x00, 0x04, 0x1C, 0x24, 0x24, 0x1A,    // Char 097 (a)
    0x20, 0x20, 0x20, 0x20, 0x38, 0x24, 0x24, 0x38,    // Char 098 (b)
    0x00, 0x00, 0x00, 0x00, 0x18, 0x20, 0x20, 0x18,    // Char 099 (c)
    0x04, 0x04, 0x04, 0x04, 0x1C, 0x24, 0x24, 0x1C,    // Char 100 (d)
    0x00, 0x00, 0x00, 0x18, 0x24, 0x3C, 0x20, 0x1C,    // Char 101 (e)
    0x00, 0x00, 0x00, 0x10, 0x28, 0x20, 0x70, 0x20,    // Char 102 (f)
    0x00, 0x00, 0x00, 0x0C, 0x14, 0x0C, 0x24, 0x18,    // Char 103 (g)
    0x20, 0x20, 0x20, 0x20, 0x20, 0x38, 0x24, 0x24,    // Char 104 (h)
    0x00, 0x00, 0x00, 0x10, 0x00, 0x10, 0x10, 0x10,    // Char 105 (i)
    0x00, 0x00, 0x08, 0x00, 0x08, 0x08, 0x48, 0x30,    // Char 106 (j)
    0x00, 0x00, 0x20, 0x20, 0x28, 0x30, 0x28, 0x28,    // Char 107 (k)
    0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x24, 0x18,    // Char 108 (l)
    0x00, 0x00, 0x00, 0x40, 0x68, 0x54, 0x44, 0x44,    // Char 109 (m)
    0x00, 0x00, 0x00, 0x20, 0x38, 0x24, 0x24, 0x24,    // Char 110 (n)
    0x00, 0x00, 0x00, 0x00, 0x18, 0x24, 0x24, 0x18,    // Char 111 (o)
    0x00, 0x00, 0x00, 0x18, 0x14, 0x18, 0x10, 0x10,    // Char 112 (p)
    0x00, 0x00, 0x00, 0x18, 0x28, 0x18, 0x0A, 0x0C,    // Char 113 (q)
    0x00, 0x00, 0x00, 0x20, 0x38, 0x24, 0x20, 0x20,    // Char 114 (r)
    0x00, 0x00, 0x38, 0x40, 0x30, 0x08, 0x48, 0x30,    // Char 115 (s)
    0x00, 0x00, 0x00, 0x20, 0x38, 0x20, 0x24, 0x18,    // Char 116 (t)
    0x00, 0x00, 0x00, 0x00, 0x44, 0x44, 0x44, 0x3A,    // Char 117 (u)
    0x00, 0x00, 0x00, 0x00, 0x44, 0x44, 0x28, 0x10,    // Char 118 (v)
    0x00, 0x00, 0x00, 0x00, 0x41, 0x41, 0x2A, 0x14,    // Char 119 (w)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x10, 0x28,    // Char 120 (x)
    0x00, 0x00, 0x24, 0x14, 0x0C, 0x04, 0x28, 0x10,    // Char 121 (y)
    0x00, 0x00, 0x00, 0x3C, 0x04, 0x08, 0x10, 0x3C,    // Char 122 (z)
    0x00, 0x0C, 0x10, 0x10, 0x20, 0x10, 0x10, 0x0C,    // Char 123 ({)
    0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,    // Char 124 (|)
    0x00, 0x30, 0x08, 0x08, 0x04, 0x08, 0x08, 0x30,    // Char 125 (})
    0x00, 0x00, 0x00, 0x00, 0x32, 0x4C, 0x00, 0x00,    // Char 126 (~)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 127 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 128 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 129 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 130 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 131 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 132 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 133 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 134 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 135 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 136 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 137 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 138 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 139 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 140 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 141 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 142 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 143 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 144 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 145 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 146 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 147 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 148 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 149 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 150 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 151 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 152 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 153 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 154 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 155 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 156 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 157 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 158 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 159 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 160 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 161 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 162 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 163 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 164 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 165 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 166 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 167 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 168 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 169 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 170 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 171 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 172 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 173 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 174 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 175 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 176 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 177 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 178 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 179 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 180 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 181 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 182 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 183 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 184 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 185 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 186 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 187 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 188 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 189 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 190 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 191 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 192 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 193 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 194 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 195 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 196 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 197 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 198 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 199 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 200 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 201 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 202 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 203 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 204 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 205 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 206 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 207 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 208 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 209 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 210 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 211 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 212 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 213 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 214 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 215 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 216 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 217 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 218 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 219 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 220 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 221 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 222 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 223 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 224 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 225 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 226 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 227 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 228 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 229 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 230 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 231 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 232 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 233 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 234 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 235 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 236 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 237 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 238 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 239 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 240 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 241 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 242 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 243 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 244 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 245 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 246 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 247 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 248 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 249 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 250 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 251 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 252 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 253 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,    // Char 254 (.)
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00    // Char 255 (.)
};


END OF HEADER FILE (font.h).

And a main.c file.

#include <stdio.h>
#include <gb/font.h>
#include <gb/console.h>
#include <gb/drawing.h>
#include "font.h"

int main(){
    font_t font;
    font_init();
    font = font_load(font);
    font_set(font);
    printf("Urgh...");
}

END OF main.c FILE.

And here is a screenshot of what comes out!

https://i.imgur.com/ZV39sEz.png

This question should be fairly self-explanatory - any ideas?

Last edited by wolfboyft (2015-05-31 11:22:16)

Offline

 

#2 2015-06-01 10:03:00

RoboTwo
Member
From: Sweden
Registered: 2014-10-29
Posts: 19

Re: Fonts aren't working...? I used 8x8 pixel rom font editor

My first instinctive thought is that you only provide 8 bytes per character as opposed to 16 as the graphics uses two bitplanes.
Try duplicating each byte and put it in direct succession of itself.

as in:

0x18, 0x3C, 0x3C, 0x18, 0x18, 0x00, 0x18, 0x18,    // Char 033 (!)
becomes
0x18, 0x18, 0x3C, 0x3C, 0x3C, 0x3C, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18,    // Char 033 (!)
etc.

Not sure how GBDK formats its fonts, but I'd expect them to be just straightforward 16 bytes per tile as it seems to generate all 4 shades in the image you've linked.

Last edited by RoboTwo (2015-06-01 10:20:43)


Shake well before use

Offline

 

#3 2015-06-02 13:46:52

wolfboyft
Member
Registered: 2015-02-02
Posts: 10

Re: Fonts aren't working...? I used 8x8 pixel rom font editor

RoboTwo wrote:

My first instinctive thought is that you only provide 8 bytes per character as opposed to 16 as the graphics uses two bitplanes.
Try duplicating each byte and put it in direct succession of itself.

as in:

0x18, 0x3C, 0x3C, 0x18, 0x18, 0x00, 0x18, 0x18,    // Char 033 (!)
becomes
0x18, 0x18, 0x3C, 0x3C, 0x3C, 0x3C, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18,    // Char 033 (!)
etc.

Not sure how GBDK formats its fonts, but I'd expect them to be just straightforward 16 bytes per tile as it seems to generate all 4 shades in the image you've linked.

IDEA! GUESS!

Maybe they're tiles!? What an unprofessional font editor... oh well.

Offline

 

#4 2015-06-02 14:27:41

RoboTwo
Member
From: Sweden
Registered: 2014-10-29
Posts: 19

Re: Fonts aren't working...? I used 8x8 pixel rom font editor

Well all graphics on the GB is made up by the same characters in VRAM (albeit you can reconfigure the order a bit)
So everything could be considered tiles essentially and the fonts in GBDK is no different.
The only thing that may differ is how you store it in ROM and/or modify the data before loading it into VRAM, and that might be what differs between the font editor you use and how GBDK handles its fonts.

So was the problem solved or not?


Shake well before use

Offline

 

#5 2015-07-14 09:18:09

Xephyr
Member
From: France
Registered: 2015-02-26
Posts: 59

Re: Fonts aren't working...? I used 8x8 pixel rom font editor

Hey, I'm trying to set my own custom font so I'm interested on that point too.
I tried to duplicate each bytes as RoboTwo suggested, but the program won't compile, giving me an overflow.

Otherwise, from what I read on the documentation of GBDK, there's a way to specify that your font is using only 8 bytes per character (here : http://gbdk.sourceforge.net/doc/html/c0 … CTURE-TYPE) but I don't know how to set that.

I think the easiest way to pass the problem would be to code the font directly in asm as done for the exemple fonts, but how should I link that to my C code after?

I hadn't done a lot asm before so I'm not really good about it, so if you can help me that would be really nice.

Offline

 

#6 2015-07-14 12:59:57

Scazon
Member
From: Boston, MA
Registered: 2015-06-14
Posts: 24
Website

Re: Fonts aren't working...? I used 8x8 pixel rom font editor

If you're getting an overflow error, try making the array const, i.e. const unsigned char font[];
That'll cut down on memory usage for the array. I usually also save tile sets and other large arrays in other memory banks to save space, but that's up to you.

Offline

 

#7 2015-07-14 13:34:06

Xephyr
Member
From: France
Registered: 2015-02-26
Posts: 59

Re: Fonts aren't working...? I used 8x8 pixel rom font editor

Okay, so now it compiled using a const array.

However, most characters seems to be messy. I took the font showed on the first post and duplicate some characters (for exemple, $ and %), for the other ones I filled with 0x00 which shouldn't be a problem.

If I try to print "$%", the result I have is the following :
http://www.plixup.com/pics_core3/14368952382808font.png

Last edited by Xephyr (2015-07-14 13:34:36)

Offline

 

#8 2015-08-07 01:21:10

l0k1
Member
Registered: 2014-10-23
Posts: 44

Re: Fonts aren't working...? I used 8x8 pixel rom font editor

So I loaded some of this data up as tile data, and loaded the rom into BGB, and here's the data from the VRAM viewer:
https://i.imgur.com/IeQJKXj.png
I set tile 0 to $00, so it should've been blank. But it looks like this "font" is working, and is just slightly bigger than 2 letters per tile high. I can make out numbers/letters, etc. So, yeah, it'd look like gibberish normally unless GBDK has some special way of displaying it. I use assembly/RGBASM and don't have any experience with GBDK, so I wouldn't be much help there.

EDIT: Just wanted to clarify - just doubling up the bytes isn't working. It isn't 2 letters per tile. It's like ~2.1 letters per tile.

Last edited by l0k1 (2015-08-07 11:19:12)

Offline

 

#9 2015-08-07 12:49:08

Xephyr
Member
From: France
Registered: 2015-02-26
Posts: 59

Re: Fonts aren't working...? I used 8x8 pixel rom font editor

Okay, if you find how to solve the problem feel free to answer here. I think it could be really helpful.

Offline

 

#10 2015-08-07 13:27:56

Scazon
Member
From: Boston, MA
Registered: 2015-06-14
Posts: 24
Website

Re: Fonts aren't working...? I used 8x8 pixel rom font editor

I haven't used the font library with GBDK before, but here's how I load fonts:

I have a const UBYTE array which defines the 8x8 pixels tiles of ASCII characters 0 through 127. If I have any special character tiles in my game that I want to use (e.g. button symbols), I'll load them into unused tiles, i.e. 1-31.

Code:

const UBYTE fontTiles[] =
{ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, //0, null char
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, //1, unused
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, //2, unused
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    ...
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, //32, space
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x08,0x08, //33, !
  0x08,0x08,0x00,0x00,0x08,0x08,0x00,0x00,
  0x00,0x00,0x12,0x12,0x24,0x24,0x24,0x24, //34, "
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x12,0x12,0x3F,0x3F,0x12,0x12, //35, #
       ...
}

In my game, I load the font with

Code:

set_bkg_data(0,128,fontTiles);

Then when I want to print stuff, I use this custom print function:

Code:

void print(UBYTE x, UBYTE y, UBYTE *str, UBYTE len){
   set_bkg_tiles(x, y, len, 1, str);
}

I used have it use strlen(str), but that apparently isn't always reliable, so I hardcode the length of the string when I call it, e.g. for hello world, you'd have to call it like:

Code:

print(1,1,"Hello World",11);

This print function doesn't wrap around to new lines. And if you want to print numbers, you'd have to make a placeholder array and call sprintf(), e.g.

Code:

UBYTE placeholder[2]; //can hold 1 digit and a trailing null char
sprintf(placeholder, "%d", (UWORD)2+5);
print(1,1,"2+5=",4);
print(5,1,placeholder,1);

I'm currently trying to make this system better, but if using the font library doesn't work, here's an alternative.

Last edited by Scazon (2015-08-07 13:29:25)

Offline

 

#11 2015-08-07 23:42:40

l0k1
Member
Registered: 2014-10-23
Posts: 44

Re: Fonts aren't working...? I used 8x8 pixel rom font editor

I unfortunately don't care enough about GBDK to learn it to solve this problem, sorry. I need to spend my time focusing on ASM.
The GBDK documentation is here: http://gbdk.sourceforge.net/doc/gbdk-doc.pdf
Per the font part of that, I'd check the font_struct to see if it's encoding the font in 8 bytes or 16 bytes (using bit 3 of the returned font_struct). AFAIK, it's doing compression on the tiles, and then decompressing them before loading them into VRAM, if that bit is set.
You could try using mprint_string() instead of printf(). Or try decompressing them yourself, using the data from the document I linked.
G'luck.

Offline

 

#12 2015-09-07 10:41:55

Xephyr
Member
From: France
Registered: 2015-02-26
Posts: 59

Re: Fonts aren't working...? I used 8x8 pixel rom font editor

Okay, so I'm bumping again this subject.

I decided to use the font via an asm file (made following the included ibmfixed.s).

Here's the file if you want to check it (nothing fancy) :

Code:

;font generated by Xephyr

    .area    _BASE
    .globl    font_load
    
_font_load_custom::        ; Banked
    ld    hl,#_font_custom
    call    font_load
    ret

_font_custom::
    .db 1+4
    .db 95

;font encoding table
    .db 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
    .db 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
    .db 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F
    .db 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F
    .db 0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F
    .db 0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F
    .db 0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F
    .db 0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x00

_font_custom_tiles::    
;Character   (32)
    .db 0b00000000
    .db 0b00000000
    .db 0b00000000
    .db 0b00000000
    .db 0b00000000
    .db 0b00000000
    .db 0b00000000
    .db 0b00000000

;Character ! (33)
    .db 0b00000000
    .db 0b00011000
    .db 0b00011000
    .db 0b00011000
    .db 0b00011000
    .db 0b00011000
    .db 0b00000000
    .db 0b00011000

;Character " (34)
    .db 0b00000000
    .db 0b00000000
    .db 0b00101000
    .db 0b00101000
    .db 0b00000000
    .db 0b00000000
    .db 0b00000000
    .db 0b00000000

;Character # (35)
    .db 0b00000000
    .db 0b00000000
    .db 0b00101000
    .db 0b01111100
    .db 0b00101000
    .db 0b01111100
    .db 0b00101000
    .db 0b00000000

;Character $ (36)
    .db 0b00000000
    .db 0b00111000
    .db 0b01000000
    .db 0b11111110
    .db 0b00111000
    .db 0b11111110
    .db 0b00000100
    .db 0b00111000

;Character % (37)
    .db 0b00000000
    .db 0b01000000
    .db 0b10100100
    .db 0b01001000
    .db 0b00010000
    .db 0b00100100
    .db 0b01001010
    .db 0b00000100

;Character & (38)
    .db 0b00000000
    .db 0b00000000
    .db 0b00000000
    .db 0b00000000
    .db 0b00000000
    .db 0b00000000
    .db 0b00000000
    .db 0b00000000

;Character ' (39)
    .db 0b00000000
    .db 0b00000000
    .db 0b00010000
    .db 0b00010000
    .db 0b00000000
    .db 0b00000000
    .db 0b00000000
    .db 0b00000000

;Character ( (40)
    .db 0b00000000
    .db 0b00010000
    .db 0b00100000
    .db 0b01100000
    .db 0b01100000
    .db 0b01100000
    .db 0b00100000
    .db 0b00010000

;Character ) (41)
    .db 0b00000000
    .db 0b00100000
    .db 0b00010000
    .db 0b00011000
    .db 0b00011000
    .db 0b00011000
    .db 0b00010000
    .db 0b00100000

;Character * (42)
    .db 0b00000000
    .db 0b00000000
    .db 0b00000000
    .db 0b00101000
    .db 0b00010000
    .db 0b00101000
    .db 0b00000000
    .db 0b00000000

;Character + (43)
    .db 0b00000000
    .db 0b00000000
    .db 0b00000000
    .db 0b00010000
    .db 0b00111000
    .db 0b00010000
    .db 0b00000000
    .db 0b00000000

;Character , (44)
    .db 0b00000000
    .db 0b00000000
    .db 0b00000000
    .db 0b00000000
    .db 0b00000000
    .db 0b00000000
    .db 0b00000000
    .db 0b00000000

;Character - (45)
    .db 0b00000000
    .db 0b00000000
    .db 0b00000000
    .db 0b00000000
    .db 0b00111000
    .db 0b00000000
    .db 0b00000000
    .db 0b00000000

;Character . (46)
    .db 0b00000000
    .db 0b00000000
    .db 0b00000000
    .db 0b00000000
    .db 0b00000000
    .db 0b00000000
    .db 0b00011000
    .db 0b00011000

;Character / (47)
    .db 0b00000000
    .db 0b00000010
    .db 0b00000100
    .db 0b00001000
    .db 0b00010000
    .db 0b00100000
    .db 0b01000000
    .db 0b10000000

;Character 0 (48)
    .db 0b00000000
    .db 0b00000000
    .db 0b01111110
    .db 0b01000110
    .db 0b01000110
    .db 0b01000110
    .db 0b01000110
    .db 0b01111110

;Character 1 (49)
    .db 0b00000000
    .db 0b00000000
    .db 0b00011000
    .db 0b00111000
    .db 0b00011000
    .db 0b00011000
    .db 0b00011000
    .db 0b01111110

;Character 2 (50)
    .db 0b00000000
    .db 0b00000000
    .db 0b01111110
    .db 0b00000110
    .db 0b00000110
    .db 0b01111110
    .db 0b01100000
    .db 0b01111110

;Character 3 (51)
    .db 0b00000000
    .db 0b00000000
    .db 0b01111110
    .db 0b00000110
    .db 0b00000110
    .db 0b00011110
    .db 0b00000110
    .db 0b01111110

;Character 4 (52)
    .db 0b00000000
    .db 0b00000000
    .db 0b00011100
    .db 0b00101100
    .db 0b01001100
    .db 0b01111110
    .db 0b00001100
    .db 0b00001100

;Character 5 (53)
    .db 0b00000000
    .db 0b00000000
    .db 0b01111110
    .db 0b01000000
    .db 0b01000000
    .db 0b01111110
    .db 0b00000110
    .db 0b01111110

;Character 6 (54)
    .db 0b00000000
    .db 0b00000000
    .db 0b01111110
    .db 0b01000000
    .db 0b01000000
    .db 0b01111110
    .db 0b01000110
    .db 0b01111110

;Character 7 (55)
    .db 0b00000000
    .db 0b00000000
    .db 0b01111110
    .db 0b00000110
    .db 0b00000110
    .db 0b00000110
    .db 0b00000110
    .db 0b00000110

;Character 8 (56)
    .db 0b00000000
    .db 0b00000000
    .db 0b01111110
    .db 0b01000110
    .db 0b01000110
    .db 0b01111110
    .db 0b01000110
    .db 0b01111110

;Character 9 (57)
    .db 0b00000000
    .db 0b00000000
    .db 0b01111110
    .db 0b01000110
    .db 0b01000110
    .db 0b01111110
    .db 0b00000110
    .db 0b01111110

;Character : (58)
    .db 0b00000000
    .db 0b00000000
    .db 0b00000000
    .db 0b00011000
    .db 0b00011000
    .db 0b00000000
    .db 0b00011000
    .db 0b00011000

;Character ; (59)
    .db 0b00000000
    .db 0b00000000
    .db 0b00011000
    .db 0b00011000
    .db 0b00000000
    .db 0b00011000
    .db 0b00001000
    .db 0b00010000

;Character < (60)
    .db 0b00000000
    .db 0b00011100
    .db 0b00111000
    .db 0b01110000
    .db 0b01110000
    .db 0b00111000
    .db 0b00011100
    .db 0b00000000

;Character = (61)
    .db 0b00000000
    .db 0b00000000
    .db 0b00000000
    .db 0b00111000
    .db 0b00000000
    .db 0b00111000
    .db 0b00000000
    .db 0b00000000

;Character > (62)
    .db 0b00000000
    .db 0b01110000
    .db 0b00111000
    .db 0b00011100
    .db 0b00011100
    .db 0b00111000
    .db 0b01110000
    .db 0b00000000

;Character ? (63)
    .db 0b00000000
    .db 0b00111100
    .db 0b01100110
    .db 0b01000110
    .db 0b00001100
    .db 0b00011000
    .db 0b00000000
    .db 0b00011000

;Character @ (64)
    .db 0b00000000
    .db 0b00111000
    .db 0b01010100
    .db 0b10101010
    .db 0b10111010
    .db 0b10101010
    .db 0b01000100
    .db 0b00111000

;Character A (65)
    .db 0b00000000
    .db 0b01111100
    .db 0b10000110
    .db 0b10000110
    .db 0b11111110
    .db 0b10000110
    .db 0b10000110
    .db 0b10000110

;Character B (66)
    .db 0b00000000
    .db 0b11111000
    .db 0b10001100
    .db 0b10001100
    .db 0b11111100
    .db 0b10000110
    .db 0b10000110
    .db 0b11111110

;Character C (67)
    .db 0b00000000
    .db 0b01111100
    .db 0b10000110
    .db 0b10000000
    .db 0b10000000
    .db 0b10000000
    .db 0b10000110
    .db 0b01111100

;Character D (68)
    .db 0b00000000
    .db 0b11111100
    .db 0b10000110
    .db 0b10000110
    .db 0b10000110
    .db 0b10000110
    .db 0b10000110
    .db 0b11111100

;Character E (69)
    .db 0b00000000
    .db 0b11111110
    .db 0b10000000
    .db 0b10000000
    .db 0b11111000
    .db 0b10000000
    .db 0b10000000
    .db 0b11111110

;Character F (70)
    .db 0b00000000
    .db 0b11111110
    .db 0b10000000
    .db 0b10000000
    .db 0b11111000
    .db 0b10000000
    .db 0b10000000
    .db 0b10000000

;Character G (71)
    .db 0b00000000
    .db 0b01111100
    .db 0b10000110
    .db 0b10000000
    .db 0b10011110
    .db 0b10000110
    .db 0b10000110
    .db 0b01111100

;Character H (72)
    .db 0b00000000
    .db 0b10000110
    .db 0b10000110
    .db 0b10000110
    .db 0b11111110
    .db 0b10000110
    .db 0b10000110
    .db 0b10000110

;Character I (73)
    .db 0b00000000
    .db 0b11111110
    .db 0b00010000
    .db 0b00010000
    .db 0b00010000
    .db 0b00010000
    .db 0b00010000
    .db 0b11111110

;Character J (74)
    .db 0b00000000
    .db 0b11111110
    .db 0b00000110
    .db 0b00000110
    .db 0b00000110
    .db 0b00000110
    .db 0b10000110
    .db 0b01111100

;Character K (75)
    .db 0b00000000
    .db 0b10000110
    .db 0b10000110
    .db 0b10000110
    .db 0b11111100
    .db 0b10000110
    .db 0b10000110
    .db 0b10000110

;Character L (76)
    .db 0b00000000
    .db 0b10000000
    .db 0b10000000
    .db 0b10000000
    .db 0b10000000
    .db 0b10000000
    .db 0b10000000
    .db 0b11111110

;Character M (77)
    .db 0b00000000
    .db 0b11000110
    .db 0b10101110
    .db 0b10010110
    .db 0b10000110
    .db 0b10000110
    .db 0b10000110
    .db 0b10000110

;Character N (78)
    .db 0b00000000
    .db 0b11000110
    .db 0b10100110
    .db 0b10010110
    .db 0b10001110
    .db 0b10000110
    .db 0b10000110
    .db 0b10000110

;Character O (79)
    .db 0b00000000
    .db 0b00111000
    .db 0b01000100
    .db 0b10000110
    .db 0b10000110
    .db 0b10000110
    .db 0b01000100
    .db 0b00111000

;Character P (80)
    .db 0b00000000
    .db 0b11111100
    .db 0b10000110
    .db 0b10000110
    .db 0b11111100
    .db 0b10000000
    .db 0b10000000
    .db 0b10000000

;Character Q (81)
    .db 0b00000000
    .db 0b00111000
    .db 0b01000100
    .db 0b10000110
    .db 0b10000110
    .db 0b10000110
    .db 0b01001100
    .db 0b00111010

;Character R (82)
    .db 0b00000000
    .db 0b11111100
    .db 0b10000110
    .db 0b10000110
    .db 0b11111100
    .db 0b10000110
    .db 0b10000110
    .db 0b10000110

;Character S (83)
    .db 0b00000000
    .db 0b01111100
    .db 0b10000110
    .db 0b10000000
    .db 0b01111100
    .db 0b00000110
    .db 0b10000110
    .db 0b01111100

;Character T (84)
    .db 0b00000000
    .db 0b11111110
    .db 0b00010000
    .db 0b00010000
    .db 0b00010000
    .db 0b00010000
    .db 0b00010000
    .db 0b00010000

;Character U (85)
    .db 0b00000000
    .db 0b10000110
    .db 0b10000110
    .db 0b10000110
    .db 0b10000110
    .db 0b10000110
    .db 0b10000110
    .db 0b01111100

;Character V (86)
    .db 0b00000000
    .db 0b10000010
    .db 0b10000010
    .db 0b01000100
    .db 0b01000100
    .db 0b00101000
    .db 0b00101000
    .db 0b00010000

;Character W (87)
    .db 0b00000000
    .db 0b10000110
    .db 0b10000110
    .db 0b10000110
    .db 0b10000110
    .db 0b10010110
    .db 0b10010110
    .db 0b01101100

;Character X (88)
    .db 0b00000000
    .db 0b10000010
    .db 0b01000100
    .db 0b00101000
    .db 0b00010000
    .db 0b00101000
    .db 0b01000100
    .db 0b10000010

;Character Y (89)
    .db 0b00000000
    .db 0b10000110
    .db 0b10000110
    .db 0b01000100
    .db 0b00101000
    .db 0b00010000
    .db 0b00010000
    .db 0b00010000

;Character Z (90)
    .db 0b00000000
    .db 0b11111110
    .db 0b00000110
    .db 0b00001000
    .db 0b00010000
    .db 0b00100000
    .db 0b01000110
    .db 0b11111110

;Character [ (91)
    .db 0b00000000
    .db 0b01111000
    .db 0b01100000
    .db 0b01100000
    .db 0b01100000
    .db 0b01100000
    .db 0b01100000
    .db 0b01111000

;Character \ (92)
    .db 0b00000000
    .db 0b10000000
    .db 0b01000000
    .db 0b00100000
    .db 0b00010000
    .db 0b00001000
    .db 0b00000100
    .db 0b00000010

;Character ] (93)
    .db 0b00000000
    .db 0b00111100
    .db 0b00001100
    .db 0b00001100
    .db 0b00001100
    .db 0b00001100
    .db 0b00001100
    .db 0b00111100

;Character ^ (94)
    .db 0b00000000
    .db 0b00000000
    .db 0b00000000
    .db 0b00000000
    .db 0b00000000
    .db 0b00000000
    .db 0b00000000
    .db 0b00000000

;Character _ (95)
    .db 0b00000000
    .db 0b00000000
    .db 0b00000000
    .db 0b00000000
    .db 0b00000000
    .db 0b00000000
    .db 0b00000000
    .db 0b01111110

;Character ` (96)
    .db 0b00000000
    .db 0b00000000
    .db 0b00000000
    .db 0b00000000
    .db 0b00000000
    .db 0b00000000
    .db 0b00000000
    .db 0b00000000

;Character a (97)
    .db 0b00000000
    .db 0b01111100
    .db 0b10000110
    .db 0b10000110
    .db 0b11111110
    .db 0b10000110
    .db 0b10000110
    .db 0b10000110

;Character b (98)
    .db 0b00000000
    .db 0b11111000
    .db 0b10001100
    .db 0b10001100
    .db 0b11111100
    .db 0b10000110
    .db 0b10000110
    .db 0b11111110

;Character c (99)
    .db 0b00000000
    .db 0b01111100
    .db 0b10000110
    .db 0b10000000
    .db 0b10000000
    .db 0b10000000
    .db 0b10000110
    .db 0b01111100

;Character d (100)
    .db 0b00000000
    .db 0b11111100
    .db 0b10000110
    .db 0b10000110
    .db 0b10000110
    .db 0b10000110
    .db 0b10000110
    .db 0b11111100

;Character e (101)
    .db 0b00000000
    .db 0b11111110
    .db 0b10000000
    .db 0b10000000
    .db 0b11111000
    .db 0b10000000
    .db 0b10000000
    .db 0b11111110

;Character f (102)
    .db 0b00000000
    .db 0b11111110
    .db 0b10000000
    .db 0b10000000
    .db 0b11111000
    .db 0b10000000
    .db 0b10000000
    .db 0b10000000

;Character g (103)
    .db 0b00000000
    .db 0b01111100
    .db 0b10000110
    .db 0b10000000
    .db 0b10011110
    .db 0b10000110
    .db 0b10000110
    .db 0b01111100

;Character h (104)
    .db 0b00000000
    .db 0b10000110
    .db 0b10000110
    .db 0b10000110
    .db 0b11111110
    .db 0b10000110
    .db 0b10000110
    .db 0b10000110

;Character i (105)
    .db 0b00000000
    .db 0b11111110
    .db 0b00010000
    .db 0b00010000
    .db 0b00010000
    .db 0b00010000
    .db 0b00010000
    .db 0b11111110

;Character j (106)
    .db 0b00000000
    .db 0b11111110
    .db 0b00000110
    .db 0b00000110
    .db 0b00000110
    .db 0b00000110
    .db 0b10000110
    .db 0b01111100

;Character k (107)
    .db 0b00000000
    .db 0b10000110
    .db 0b10000110
    .db 0b10000110
    .db 0b11111100
    .db 0b10000110
    .db 0b10000110
    .db 0b10000110

;Character l (108)
    .db 0b00000000
    .db 0b10000000
    .db 0b10000000
    .db 0b10000000
    .db 0b10000000
    .db 0b10000000
    .db 0b10000000
    .db 0b11111110

;Character m (109)
    .db 0b00000000
    .db 0b11000110
    .db 0b10101110
    .db 0b10010110
    .db 0b10000110
    .db 0b10000110
    .db 0b10000110
    .db 0b10000110

;Character n (110)
    .db 0b00000000
    .db 0b11000110
    .db 0b10100110
    .db 0b10010110
    .db 0b10001110
    .db 0b10000110
    .db 0b10000110
    .db 0b10000110

;Character o (111)
    .db 0b00000000
    .db 0b00111000
    .db 0b01000100
    .db 0b10000110
    .db 0b10000110
    .db 0b10000110
    .db 0b01000100
    .db 0b00111000

;Character p (112)
    .db 0b00000000
    .db 0b11111100
    .db 0b10000110
    .db 0b10000110
    .db 0b11111100
    .db 0b10000000
    .db 0b10000000
    .db 0b10000000

;Character q (113)
    .db 0b00000000
    .db 0b00111000
    .db 0b01000100
    .db 0b10000110
    .db 0b10000110
    .db 0b10000110
    .db 0b01001100
    .db 0b00111010

;Character r (114)
    .db 0b00000000
    .db 0b11111100
    .db 0b10000110
    .db 0b10000110
    .db 0b11111100
    .db 0b10000110
    .db 0b10000110
    .db 0b10000110

;Character s (115)
    .db 0b00000000
    .db 0b01111100
    .db 0b10000110
    .db 0b10000000
    .db 0b01111100
    .db 0b00000110
    .db 0b10000110
    .db 0b01111100

;Character t (116)
    .db 0b00000000
    .db 0b11111110
    .db 0b00010000
    .db 0b00010000
    .db 0b00010000
    .db 0b00010000
    .db 0b00010000
    .db 0b00010000

;Character u (117)
    .db 0b00000000
    .db 0b10000110
    .db 0b10000110
    .db 0b10000110
    .db 0b10000110
    .db 0b10000110
    .db 0b10000110
    .db 0b01111100

;Character v (118)
    .db 0b00000000
    .db 0b10000010
    .db 0b10000010
    .db 0b01000100
    .db 0b01000100
    .db 0b00101000
    .db 0b00101000
    .db 0b00010000

;Character w (119)
    .db 0b00000000
    .db 0b10000110
    .db 0b10000110
    .db 0b10000110
    .db 0b10000110
    .db 0b10010110
    .db 0b10010110
    .db 0b01101100

;Character x (120)
    .db 0b00000000
    .db 0b10000010
    .db 0b01000100
    .db 0b00101000
    .db 0b00010000
    .db 0b00101000
    .db 0b01000100
    .db 0b10000010

;Character y (121)
    .db 0b00000000
    .db 0b10000110
    .db 0b10000110
    .db 0b01000100
    .db 0b00101000
    .db 0b00010000
    .db 0b00010000
    .db 0b00010000

;Character z (122)
    .db 0b00000000
    .db 0b11111110
    .db 0b00000110
    .db 0b00001000
    .db 0b00010000
    .db 0b00100000
    .db 0b01000110
    .db 0b11111110

;Character { (123)
    .db 0b00000000
    .db 0b00111000
    .db 0b01100000
    .db 0b01100000
    .db 0b11000000
    .db 0b01100000
    .db 0b01100000
    .db 0b00111000

;Character | (124)
    .db 0b00000000
    .db 0b00010000
    .db 0b00010000
    .db 0b00010000
    .db 0b00010000
    .db 0b00010000
    .db 0b00010000
    .db 0b00010000

;Character } (125)
    .db 0b00000000
    .db 0b00111000
    .db 0b00001100
    .db 0b00001100
    .db 0b00000110
    .db 0b00001100
    .db 0b00001100
    .db 0b00111000

;Character ~ (126)
    .db 0b00000000
    .db 0b00000000
    .db 0b00000000
    .db 0b00000000
    .db 0b00110010
    .db 0b01001100
    .db 0b00000000
    .db 0b00000000

;end of file

Anyway, after that I made a simple program to load the font and print some text :

Code:

void main(void)
{
    font_t custom_font;
    
    font_init();
    
    custom_font = font_load(font_custom);  // 95 tiles
    
    mode(get_mode() | M_NO_SCROLL);
    
    font_set(custom_font);
    printf("Simple test:\n");
    printf("100 working?\n");
}

Then, I launch the resulting gb file and... here's the result :
http://www.plixup.com/pics_core3/14416368066144result_custom_font.png

It's a bit better that what we had previously, but it still has some display issues.
Do you know where would the problem be?

My guess would be that it comes from the compressing thing or I don't know, but I've set the font as 128 characters compressed (8 bytes for one character). According to the doc, it should expend automatically to 16 bytes.

I tried to load the tiles on BGB VRAM viewer, but it gives me the same result. So I think the problem comes from the compilation?

Last edited by Xephyr (2015-09-07 11:14:52)

Offline

 

#13 2015-09-07 11:20:18

a cat
Member
Registered: 2014-07-27
Posts: 98

Re: Fonts aren't working...? I used 8x8 pixel rom font editor

if you make spaces between all the letter do you still have this problem

just wondering if its because the font is being squashed together

so like:
printf("H E L L O\nW O R L D")


a cat in need of knowledge!!

Offline

 

#14 2015-09-07 11:35:16

Xephyr
Member
From: France
Registered: 2015-02-26
Posts: 59

Re: Fonts aren't working...? I used 8x8 pixel rom font editor

Still the same problem yes.

As you can see on the VRAM viewer, the tiles are saved in that form in the memory :
http://www.plixup.com/pics_core3/14416400713043vram.png

Last edited by Xephyr (2015-09-07 11:35:25)

Offline

 

#15 2015-09-08 07:17:27

Xephyr
Member
From: France
Registered: 2015-02-26
Posts: 59

Re: Fonts aren't working...? I used 8x8 pixel rom font editor

Okay, I don't know if double posting is forbidden here (if not, sorry).

I've finally been able to run my own font. I really don't know how, but anyway. I'll try to do a test with another font and if it does work again, I'll explain the method to do so.

Offline

 

#16 2015-09-08 18:00:10

a cat
Member
Registered: 2014-07-27
Posts: 98

Re: Fonts aren't working...? I used 8x8 pixel rom font editor

"I don't know if double posting is forbidden here (if not, sorry)."
even if it is i don’t think anyone would rely mind

anyway have some room between this post so your not triple posting XD!

Last edited by a cat (2015-09-08 18:01:36)


a cat in need of knowledge!!

Offline

 

#17 2015-09-08 23:33:51

l0k1
Member
Registered: 2014-10-23
Posts: 44

Re: Fonts aren't working...? I used 8x8 pixel rom font editor

This could be 100% my ignorance showing, but in the ASM font file, you have:

Code:

 .globl font_load

Should that have been:

Code:

 .global font_load

?
No idea if that actually matters.
Barring that, it looks like something wacky on GBDK's decompression. Can't help, sorry.

Offline

 

#18 2015-09-09 03:29:12

Xephyr
Member
From: France
Registered: 2015-02-26
Posts: 59

Re: Fonts aren't working...? I used 8x8 pixel rom font editor

Well, no it doesn't change anything, and it happens that I finally don't need this line.
Anyway, I've made some others tests and it still work, so here's how to do this.

First, you'll have to make a .s file with the following datas :

Code:

    .area    _BASE

_your_font_name::    ; Name of your font
    .db 1+4        ; Correspond to the type of your font - here is a 128 bytes characters font, compressed (1bpp) - more informations : http://gbdk.sourceforge.net/doc/html/c0509.html
    .db 95        ; Number of unique characters in your font

; Encoding table - assign each ASCII character to one of your font character (if your A character is the second one, then you will have to put 0x01 for the 65th character
    .db 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
    .db 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
    .db 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F
    .db 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F
    .db 0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F
    .db 0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F
    .db 0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F
    .db 0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x00

; And now, you have to design each characters following this sequence (I've put only two for exemple)
;Character   (32)
    .db 0b00000000
    .db 0b00000000
    .db 0b00000000
    .db 0b00000000
    .db 0b00000000
    .db 0b00000000
    .db 0b00000000
    .db 0b00000000

;Character ! (33)
    .db 0b00000000
    .db 0b00011000
    .db 0b00011000
    .db 0b00011000
    .db 0b00011000
    .db 0b00011000
    .db 0b00000000
    .db 0b00011000

On this exemple, I'm using a compressed font, which mean that I each byte will represent one pixel (0 -> White, 1-> Black). If you want to use a 4-shaded font, you'll have to use 16 bytes for each characters and remove the "+4" on the font type.

In order to convert directly my font in bytes, I've made a simple program that will convert a plain PBM file (you can generate it using Paint.net for exemple) to a data file. If you want it, here it is : http://www.mediafire.com/download/6m2q0 … verter.exe
And here is what my PBM file looks like (here saved as .png, but you get the idea) : http://www.plixup.com/pics_core3/144178 … custom.png

Once your .s file is complete, move it to your project folder, and link it on the compiler (if you're using a make.bat - which I recommend - you can directly output your .gb file from .c and .s files - see compiler options if needed : http://gbdk.sourceforge.net/tools.html)

Now, in your c code, you can use your font by loading it with font_load(your_font_name).
However, the code can't compile yet. For this, you'll have to go on gbdk\include\gb, open the font.h file, and add your custom font to the list of default fonts :

Code:

/** The default fonts */
extern UINT8 font_spect[], font_italic[], font_ibm[], font_min[], your_font_name[];

And after that, everything should be working!
http://www.plixup.com/pics_core3/14417836639835working_font.png

Last edited by Xephyr (2015-09-09 03:31:31)

Offline

 

#19 2015-09-10 05:13:55

a cat
Member
Registered: 2014-07-27
Posts: 98

Re: Fonts aren't working...? I used 8x8 pixel rom font editor

Nice!


a cat in need of knowledge!!

Offline

 

#20 2015-09-26 08:34:04

wolfboyft
Member
Registered: 2015-02-02
Posts: 10

Re: Fonts aren't working...? I used 8x8 pixel rom font editor

Holy... Game Boy!

That's incredible!

Thanks, I'll use this soon enough!

Offline

 

#21 2015-09-26 16:34:55

Xephyr
Member
From: France
Registered: 2015-02-26
Posts: 59

Re: Fonts aren't working...? I used 8x8 pixel rom font editor

You're welcome, it helped me on the same time ^^

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson