diff --git a/src/debugger/gui/CartDebugWidget.hxx b/src/debugger/gui/CartDebugWidget.hxx index 43e9b42cf..a6c4a7491 100644 --- a/src/debugger/gui/CartDebugWidget.hxx +++ b/src/debugger/gui/CartDebugWidget.hxx @@ -69,14 +69,14 @@ class CartDebugWidget : public Widget, public CommandSender buf << " / " << (bytes/1024) << "KB"; w = new EditTextWidget(_boss, _font, x+lwidth, y, - fwidth, myFontHeight, buf.str()); + fwidth, myLineHeight, buf.str()); w->setEditable(false); y += myLineHeight + 4; new StaticTextWidget(_boss, _font, x, y, lwidth, myFontHeight, "Manufacturer: ", kTextAlignLeft); w = new EditTextWidget(_boss, _font, x+lwidth, y, - fwidth, myFontHeight, manufacturer); + fwidth, myLineHeight, manufacturer); w->setEditable(false); y += myLineHeight + 4; diff --git a/src/debugger/gui/CpuWidget.cxx b/src/debugger/gui/CpuWidget.cxx index 3a9caf5c2..7e83b23aa 100644 --- a/src/debugger/gui/CpuWidget.cxx +++ b/src/debugger/gui/CpuWidget.cxx @@ -45,7 +45,7 @@ CpuWidget::CpuWidget(GuiObject* boss, const GUI::Font& font, int x, int y) // Create a 1x1 grid with label for the PC register xpos = x; ypos = y; lwidth = 4 * fontWidth; - new StaticTextWidget(boss, font, xpos, ypos+2, lwidth-2, fontHeight, + new StaticTextWidget(boss, font, xpos, ypos+1, lwidth-2, fontHeight, "PC:", kTextAlignLeft); myPCGrid = new DataGridWidget(boss, font, xpos + lwidth, ypos, 1, 1, 4, 16, Common::Base::F_16); @@ -55,7 +55,7 @@ CpuWidget::CpuWidget(GuiObject* boss, const GUI::Font& font, int x, int y) // Create a read-only textbox containing the current PC label xpos += lwidth + myPCGrid->getWidth() + 10; - myPCLabel = new EditTextWidget(boss, font, xpos, ypos, fontWidth*25, + myPCLabel = new EditTextWidget(boss, font, xpos, ypos-1, fontWidth*25, lineHeight, ""); myPCLabel->setEditable(false); @@ -92,14 +92,14 @@ CpuWidget::CpuWidget(GuiObject* boss, const GUI::Font& font, int x, int y) string labels[4] = { "SP:", "A:", "X:", "Y:" }; for(int row = 0; row < 4; ++row) { - new StaticTextWidget(boss, font, xpos, ypos + row*lineHeight + 2, + new StaticTextWidget(boss, font, xpos, ypos + row*lineHeight + 1, lwidth-2, fontHeight, labels[row], kTextAlignLeft); } // Create a bitfield widget for changing the processor status xpos = x; ypos += 4*lineHeight + 2; - new StaticTextWidget(boss, font, xpos, ypos+2, lwidth-2, fontHeight, + new StaticTextWidget(boss, font, xpos, ypos+1, lwidth-2, fontHeight, "PS:", kTextAlignLeft); myPSRegister = new ToggleBitWidget(boss, font, xpos+lwidth, ypos, 8, 1); myPSRegister->setTarget(this); diff --git a/src/debugger/gui/RomWidget.cxx b/src/debugger/gui/RomWidget.cxx index 04b6eff1c..5fa5224f9 100644 --- a/src/debugger/gui/RomWidget.cxx +++ b/src/debugger/gui/RomWidget.cxx @@ -53,8 +53,8 @@ RomWidget::RomWidget(GuiObject* boss, const GUI::Font& font, "Bank state: ", kTextAlignLeft); xpos += t->getWidth() + 5; - myBank = new EditTextWidget(boss, font, xpos, ypos, - _w - 2 - xpos, font.getFontHeight()); + myBank = new EditTextWidget(boss, font, xpos, ypos-1, + _w - 2 - xpos, font.getLineHeight()); // Create rom listing xpos = x; ypos += myBank->getHeight() + 4; diff --git a/src/debugger/gui/TiaInfoWidget.cxx b/src/debugger/gui/TiaInfoWidget.cxx index 48207c109..8ef78e4c8 100644 --- a/src/debugger/gui/TiaInfoWidget.cxx +++ b/src/debugger/gui/TiaInfoWidget.cxx @@ -45,14 +45,14 @@ TiaInfoWidget::TiaInfoWidget(GuiObject* boss, const GUI::Font& font, new StaticTextWidget(boss, font, xpos, ypos, lwidth, lineHeight, "Frame:", kTextAlignLeft); xpos += lwidth; - myFrameCount = new EditTextWidget(boss, font, xpos, ypos-2, 45, lineHeight, ""); + myFrameCount = new EditTextWidget(boss, font, xpos, ypos-1, 45, lineHeight, ""); myFrameCount->setEditable(false); xpos = x; ypos += lineHeight + 5; new StaticTextWidget(boss, font, xpos, ypos, lwidth, lineHeight, "F. Cyc:", kTextAlignLeft); xpos += lwidth; - myFrameCycles = new EditTextWidget(boss, font, xpos, ypos-2, 45, lineHeight, ""); + myFrameCycles = new EditTextWidget(boss, font, xpos, ypos-1, 45, lineHeight, ""); myFrameCycles->setEditable(false); xpos = x + 10; ypos += lineHeight + 8; @@ -68,7 +68,7 @@ TiaInfoWidget::TiaInfoWidget(GuiObject* boss, const GUI::Font& font, new StaticTextWidget(boss, font, xpos, ypos, lwidth, lineHeight, "Scanline:", kTextAlignLeft); - myScanlineCount = new EditTextWidget(boss, font, xpos+lwidth, ypos-2, 30, + myScanlineCount = new EditTextWidget(boss, font, xpos+lwidth, ypos-1, 30, lineHeight, ""); myScanlineCount->setEditable(false); @@ -76,7 +76,7 @@ TiaInfoWidget::TiaInfoWidget(GuiObject* boss, const GUI::Font& font, new StaticTextWidget(boss, font, xpos, ypos, lwidth, lineHeight, "S. Cyc:", kTextAlignLeft); - myScanlineCycles = new EditTextWidget(boss, font, xpos+lwidth, ypos-2, 30, + myScanlineCycles = new EditTextWidget(boss, font, xpos+lwidth, ypos-1, 30, lineHeight, ""); myScanlineCycles->setEditable(false); @@ -84,7 +84,7 @@ TiaInfoWidget::TiaInfoWidget(GuiObject* boss, const GUI::Font& font, new StaticTextWidget(boss, font, xpos, ypos, lwidth, lineHeight, "Pixel Pos:", kTextAlignLeft); - myPixelPosition = new EditTextWidget(boss, font, xpos+lwidth, ypos-2, 30, + myPixelPosition = new EditTextWidget(boss, font, xpos+lwidth, ypos-1, 30, lineHeight, ""); myPixelPosition->setEditable(false); @@ -92,7 +92,7 @@ TiaInfoWidget::TiaInfoWidget(GuiObject* boss, const GUI::Font& font, new StaticTextWidget(boss, font, xpos, ypos, lwidth, lineHeight, "Color Clk:", kTextAlignLeft); - myColorClocks = new EditTextWidget(boss, font, xpos+lwidth, ypos-2, 30, + myColorClocks = new EditTextWidget(boss, font, xpos+lwidth, ypos-1, 30, lineHeight, ""); myColorClocks->setEditable(false); diff --git a/src/debugger/gui/TiaWidget.cxx b/src/debugger/gui/TiaWidget.cxx index 285ef43be..cbe55ee10 100644 --- a/src/debugger/gui/TiaWidget.cxx +++ b/src/debugger/gui/TiaWidget.cxx @@ -43,7 +43,7 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& font, const int fontWidth = font.getMaxCharWidth(), fontHeight = font.getFontHeight(), lineHeight = font.getLineHeight(); - int xpos = 10, ypos = 15 + lineHeight, lwidth = 4 * font.getMaxCharWidth(); + int xpos = 10, ypos = 15 + lineHeight, lwidth = 4 * fontWidth; StaticTextWidget* t; // Color registers @@ -128,54 +128,55 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& font, // Strobe buttons //////////////////////////// ButtonWidget* b; - unsigned int buttonX, buttonY; + unsigned int buttonX, buttonY, buttonW; buttonX = collX + 20*fontWidth; buttonY = ypos; - b = new ButtonWidget(boss, font, buttonX, buttonY, 50, lineHeight, + buttonW = 7 * fontWidth; + b = new ButtonWidget(boss, font, buttonX, buttonY, buttonW, lineHeight, "WSync", kWsyncCmd); b->setTarget(this); buttonY += lineHeight + 3; - b = new ButtonWidget(boss, font, buttonX, buttonY, 50, lineHeight, + b = new ButtonWidget(boss, font, buttonX, buttonY, buttonW, lineHeight, "ResP0", kResP0Cmd); b->setTarget(this); buttonY += lineHeight + 3; - b = new ButtonWidget(boss, font, buttonX, buttonY, 50, lineHeight, + b = new ButtonWidget(boss, font, buttonX, buttonY, buttonW, lineHeight, "ResM0", kResM0Cmd); b->setTarget(this); buttonY += lineHeight + 3; - b = new ButtonWidget(boss, font, buttonX, buttonY, 50, lineHeight, + b = new ButtonWidget(boss, font, buttonX, buttonY, buttonW, lineHeight, "ResBL", kResBLCmd); b->setTarget(this); buttonY += lineHeight + 3; - b = new ButtonWidget(boss, font, buttonX, buttonY, 50, lineHeight, + b = new ButtonWidget(boss, font, buttonX, buttonY, buttonW, lineHeight, "HmClr", kHmclrCmd); b->setTarget(this); buttonX += 50 + 10; buttonY = ypos; - b = new ButtonWidget(boss, font, buttonX, buttonY, 50, lineHeight, + b = new ButtonWidget(boss, font, buttonX, buttonY, buttonW, lineHeight, "RSync", kRsyncCmd); b->setTarget(this); buttonY += lineHeight + 3; - b = new ButtonWidget(boss, font, buttonX, buttonY, 50, lineHeight, + b = new ButtonWidget(boss, font, buttonX, buttonY, buttonW, lineHeight, "ResP1", kResP1Cmd); b->setTarget(this); buttonY += lineHeight + 3; - b = new ButtonWidget(boss, font, buttonX, buttonY, 50, lineHeight, + b = new ButtonWidget(boss, font, buttonX, buttonY, buttonW, lineHeight, "ResM1", kResM1Cmd); b->setTarget(this); buttonY += lineHeight + 3; - b = new ButtonWidget(boss, font, buttonX, buttonY, 50, lineHeight, + b = new ButtonWidget(boss, font, buttonX, buttonY, buttonW, lineHeight, "HMove", kHmoveCmd); b->setTarget(this); buttonY += lineHeight + 3; - b = new ButtonWidget(boss, font, buttonX, buttonY, 50, lineHeight, + b = new ButtonWidget(boss, font, buttonX, buttonY, buttonW, lineHeight, "CxClr", kCxclrCmd); b->setTarget(this); @@ -188,7 +189,7 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& font, 7*fontWidth, fontHeight, "P0: GR:", kTextAlignLeft); xpos += 7*fontWidth + 5; - myGRP0 = new TogglePixelWidget(boss, font, xpos, ypos+2, 8, 1); + myGRP0 = new TogglePixelWidget(boss, font, xpos, ypos+1, 8, 1); myGRP0->setTarget(this); myGRP0->setID(kGRP0ID); addFocusWidget(myGRP0); @@ -246,7 +247,7 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& font, addFocusWidget(myNusizP0); xpos += myNusizP0->getWidth() + 5; - myNusizP0Text = new EditTextWidget(boss, font, xpos, ypos+1, 23*fontWidth, + myNusizP0Text = new EditTextWidget(boss, font, xpos, ypos, 23*fontWidth, lineHeight, ""); myNusizP0Text->setEditable(false); @@ -258,7 +259,7 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& font, t = new StaticTextWidget(boss, font, xpos, ypos+2, 7*fontWidth, fontHeight, "P1: GR:", kTextAlignLeft); xpos += 7*fontWidth + 5; - myGRP1 = new TogglePixelWidget(boss, font, xpos, ypos+2, 8, 1); + myGRP1 = new TogglePixelWidget(boss, font, xpos, ypos+1, 8, 1); myGRP1->setTarget(this); myGRP1->setID(kGRP1ID); addFocusWidget(myGRP1); @@ -313,7 +314,7 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& font, addFocusWidget(myNusizP1); xpos += myNusizP1->getWidth() + 5; - myNusizP1Text = new EditTextWidget(boss, font, xpos, ypos+1, 23*fontWidth, + myNusizP1Text = new EditTextWidget(boss, font, xpos, ypos, 23*fontWidth, lineHeight, ""); myNusizP1Text->setEditable(false); @@ -493,21 +494,21 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& font, t = new StaticTextWidget(boss, font, xpos, ypos+2, 4*fontWidth, fontHeight, "PF:", kTextAlignLeft); xpos += 4*fontWidth; - myPF[0] = new TogglePixelWidget(boss, font, xpos, ypos+2, 4, 1); + myPF[0] = new TogglePixelWidget(boss, font, xpos, ypos+1, 4, 1); myPF[0]->setTarget(this); myPF[0]->setID(kPF0ID); addFocusWidget(myPF[0]); // PF1 xpos += myPF[0]->getWidth() + 2; - myPF[1] = new TogglePixelWidget(boss, font, xpos, ypos+2, 8, 1); + myPF[1] = new TogglePixelWidget(boss, font, xpos, ypos+1, 8, 1); myPF[1]->setTarget(this); myPF[1]->setID(kPF1ID); addFocusWidget(myPF[1]); // PF2 xpos += myPF[1]->getWidth() + 2; - myPF[2] = new TogglePixelWidget(boss, font, xpos, ypos+2, 8, 1); + myPF[2] = new TogglePixelWidget(boss, font, xpos, ypos+1, 8, 1); myPF[2]->setTarget(this); myPF[2]->setID(kPF2ID); addFocusWidget(myPF[2]); diff --git a/src/gui/ConsoleFont.hxx b/src/gui/ConsoleFont.hxx index 87b2d7f0f..943c671a0 100644 --- a/src/gui/ConsoleFont.hxx +++ b/src/gui/ConsoleFont.hxx @@ -1,8 +1,8 @@ //============================================================================ // -// SSSS tt lll lll -// SS SS tt ll ll -// SS tttttt eeee ll ll aaaa +// SSSS tt lll lll +// SS SS tt ll ll +// SS tttttt eeee ll ll aaaa // SSSS tt ee ee ll ll aa // SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator" // SS SS tt ee ll ll aa aa @@ -15,65 +15,40 @@ // this file, and for a DISCLAIMER OF ALL WARRANTIES. // // $Id$ +// +// Generated by src/tools/convbdf on Wed Jul 31 12:04:17 2013. //============================================================================ #ifndef CONSOLE_FONT_DATA_HXX #define CONSOLE_FONT_DATA_HXX -#include "bspf.hxx" +#include "Font.hxx" -namespace GUI { /* Font information: - name: 8x13 - facename: -Misc-Fixed-Medium-R-Normal--13-120-75-75-C-80-ISO10646-1 + name: 8x13-ISO8859-1 + facename: -Misc-Fixed-Medium-R-Normal--13-120-75-75-C-80-ISO8859-1 w x h: 8x13 - size: 127 + bbx: 8 13 0 -2 + size: 97 ascent: 11 descent: 2 - first char: 0 (0x00) + first char: 30 (0x1e) last char: 126 (0x7e) - default char: 0 (0x00) + default char: 30 (0x1e) proportional: no Public domain font. Share and enjoy. */ -/* Font character bitmap data. */ -static const uInt16 _console_font_bits[] = { +namespace GUI { -/* Character 0 (0x00): - width 8 - +--------+ - | | - | | - |* * * * | - | | - |* * | - | | - |* * | - | | - |* * | - | | - |* * * * | - | | - | | - +--------+ -*/ -0x0000, -0x0000, -0xaa00, -0x0000, -0x8200, -0x0000, -0x8200, -0x0000, -0x8200, -0x0000, -0xaa00, -0x0000, -0x0000, +// Font character bitmap data. +static const uInt16 console_font_bits[] = { -/* Character 30 (0x1e): large centered rounded rectangle +/* MODIFIED + Character 30 (0x1e): large centered rounded rectangle width 8 + bbx ( 8, 13, 0, -2 ) + +--------+ | **** | | ****** | @@ -104,8 +79,11 @@ static const uInt16 _console_font_bits[] = { 0x7e00, 0x3c00, -/* Character 31 (0x1f): large centered circle +/* MODIFIED + Character 31 (0x1f): large centered circle width 8 + bbx ( 8, 13, 0, -2 ) + +--------+ | | | | @@ -138,6 +116,8 @@ static const uInt16 _console_font_bits[] = { /* Character 32 (0x20): width 8 + bbx ( 8, 13, 0, -2 ) + +--------+ | | | | @@ -170,6 +150,8 @@ static const uInt16 _console_font_bits[] = { /* Character 33 (0x21): width 8 + bbx ( 8, 13, 0, -2 ) + +--------+ | | | | @@ -202,6 +184,8 @@ static const uInt16 _console_font_bits[] = { /* Character 34 (0x22): width 8 + bbx ( 8, 13, 0, -2 ) + +--------+ | | | | @@ -234,6 +218,8 @@ static const uInt16 _console_font_bits[] = { /* Character 35 (0x23): width 8 + bbx ( 8, 13, 0, -2 ) + +--------+ | | | | @@ -266,6 +252,8 @@ static const uInt16 _console_font_bits[] = { /* Character 36 (0x24): width 8 + bbx ( 8, 13, 0, -2 ) + +--------+ | | | | @@ -298,6 +286,8 @@ static const uInt16 _console_font_bits[] = { /* Character 37 (0x25): width 8 + bbx ( 8, 13, 0, -2 ) + +--------+ | | | | @@ -330,6 +320,8 @@ static const uInt16 _console_font_bits[] = { /* Character 38 (0x26): width 8 + bbx ( 8, 13, 0, -2 ) + +--------+ | | | | @@ -362,6 +354,8 @@ static const uInt16 _console_font_bits[] = { /* Character 39 (0x27): width 8 + bbx ( 8, 13, 0, -2 ) + +--------+ | | | | @@ -394,6 +388,8 @@ static const uInt16 _console_font_bits[] = { /* Character 40 (0x28): width 8 + bbx ( 8, 13, 0, -2 ) + +--------+ | | | | @@ -426,6 +422,8 @@ static const uInt16 _console_font_bits[] = { /* Character 41 (0x29): width 8 + bbx ( 8, 13, 0, -2 ) + +--------+ | | | | @@ -458,6 +456,8 @@ static const uInt16 _console_font_bits[] = { /* Character 42 (0x2a): width 8 + bbx ( 8, 13, 0, -2 ) + +--------+ | | | | @@ -490,6 +490,8 @@ static const uInt16 _console_font_bits[] = { /* Character 43 (0x2b): width 8 + bbx ( 8, 13, 0, -2 ) + +--------+ | | | | @@ -522,6 +524,8 @@ static const uInt16 _console_font_bits[] = { /* Character 44 (0x2c): width 8 + bbx ( 8, 13, 0, -2 ) + +--------+ | | | | @@ -554,6 +558,8 @@ static const uInt16 _console_font_bits[] = { /* Character 45 (0x2d): width 8 + bbx ( 8, 13, 0, -2 ) + +--------+ | | | | @@ -586,6 +592,8 @@ static const uInt16 _console_font_bits[] = { /* Character 46 (0x2e): width 8 + bbx ( 8, 13, 0, -2 ) + +--------+ | | | | @@ -618,6 +626,8 @@ static const uInt16 _console_font_bits[] = { /* Character 47 (0x2f): width 8 + bbx ( 8, 13, 0, -2 ) + +--------+ | | | | @@ -650,6 +660,8 @@ static const uInt16 _console_font_bits[] = { /* Character 48 (0x30): width 8 + bbx ( 8, 13, 0, -2 ) + +--------+ | | | | @@ -682,6 +694,8 @@ static const uInt16 _console_font_bits[] = { /* Character 49 (0x31): width 8 + bbx ( 8, 13, 0, -2 ) + +--------+ | | | | @@ -714,6 +728,8 @@ static const uInt16 _console_font_bits[] = { /* Character 50 (0x32): width 8 + bbx ( 8, 13, 0, -2 ) + +--------+ | | | | @@ -746,6 +762,8 @@ static const uInt16 _console_font_bits[] = { /* Character 51 (0x33): width 8 + bbx ( 8, 13, 0, -2 ) + +--------+ | | | | @@ -778,6 +796,8 @@ static const uInt16 _console_font_bits[] = { /* Character 52 (0x34): width 8 + bbx ( 8, 13, 0, -2 ) + +--------+ | | | | @@ -810,6 +830,8 @@ static const uInt16 _console_font_bits[] = { /* Character 53 (0x35): width 8 + bbx ( 8, 13, 0, -2 ) + +--------+ | | | | @@ -842,6 +864,8 @@ static const uInt16 _console_font_bits[] = { /* Character 54 (0x36): width 8 + bbx ( 8, 13, 0, -2 ) + +--------+ | | | | @@ -874,6 +898,8 @@ static const uInt16 _console_font_bits[] = { /* Character 55 (0x37): width 8 + bbx ( 8, 13, 0, -2 ) + +--------+ | | | | @@ -906,6 +932,8 @@ static const uInt16 _console_font_bits[] = { /* Character 56 (0x38): width 8 + bbx ( 8, 13, 0, -2 ) + +--------+ | | | | @@ -938,6 +966,8 @@ static const uInt16 _console_font_bits[] = { /* Character 57 (0x39): width 8 + bbx ( 8, 13, 0, -2 ) + +--------+ | | | | @@ -970,6 +1000,8 @@ static const uInt16 _console_font_bits[] = { /* Character 58 (0x3a): width 8 + bbx ( 8, 13, 0, -2 ) + +--------+ | | | | @@ -1002,6 +1034,8 @@ static const uInt16 _console_font_bits[] = { /* Character 59 (0x3b): width 8 + bbx ( 8, 13, 0, -2 ) + +--------+ | | | | @@ -1034,6 +1068,8 @@ static const uInt16 _console_font_bits[] = { /* Character 60 (0x3c): width 8 + bbx ( 8, 13, 0, -2 ) + +--------+ | | | | @@ -1066,6 +1102,8 @@ static const uInt16 _console_font_bits[] = { /* Character 61 (0x3d): width 8 + bbx ( 8, 13, 0, -2 ) + +--------+ | | | | @@ -1098,6 +1136,8 @@ static const uInt16 _console_font_bits[] = { /* Character 62 (0x3e): width 8 + bbx ( 8, 13, 0, -2 ) + +--------+ | | | | @@ -1130,6 +1170,8 @@ static const uInt16 _console_font_bits[] = { /* Character 63 (0x3f): width 8 + bbx ( 8, 13, 0, -2 ) + +--------+ | | | | @@ -1162,6 +1204,8 @@ static const uInt16 _console_font_bits[] = { /* Character 64 (0x40): width 8 + bbx ( 8, 13, 0, -2 ) + +--------+ | | | | @@ -1194,6 +1238,8 @@ static const uInt16 _console_font_bits[] = { /* Character 65 (0x41): width 8 + bbx ( 8, 13, 0, -2 ) + +--------+ | | | | @@ -1226,6 +1272,8 @@ static const uInt16 _console_font_bits[] = { /* Character 66 (0x42): width 8 + bbx ( 8, 13, 0, -2 ) + +--------+ | | | | @@ -1258,6 +1306,8 @@ static const uInt16 _console_font_bits[] = { /* Character 67 (0x43): width 8 + bbx ( 8, 13, 0, -2 ) + +--------+ | | | | @@ -1290,6 +1340,8 @@ static const uInt16 _console_font_bits[] = { /* Character 68 (0x44): width 8 + bbx ( 8, 13, 0, -2 ) + +--------+ | | | | @@ -1322,6 +1374,8 @@ static const uInt16 _console_font_bits[] = { /* Character 69 (0x45): width 8 + bbx ( 8, 13, 0, -2 ) + +--------+ | | | | @@ -1354,6 +1408,8 @@ static const uInt16 _console_font_bits[] = { /* Character 70 (0x46): width 8 + bbx ( 8, 13, 0, -2 ) + +--------+ | | | | @@ -1386,6 +1442,8 @@ static const uInt16 _console_font_bits[] = { /* Character 71 (0x47): width 8 + bbx ( 8, 13, 0, -2 ) + +--------+ | | | | @@ -1418,6 +1476,8 @@ static const uInt16 _console_font_bits[] = { /* Character 72 (0x48): width 8 + bbx ( 8, 13, 0, -2 ) + +--------+ | | | | @@ -1450,6 +1510,8 @@ static const uInt16 _console_font_bits[] = { /* Character 73 (0x49): width 8 + bbx ( 8, 13, 0, -2 ) + +--------+ | | | | @@ -1482,6 +1544,8 @@ static const uInt16 _console_font_bits[] = { /* Character 74 (0x4a): width 8 + bbx ( 8, 13, 0, -2 ) + +--------+ | | | | @@ -1514,6 +1578,8 @@ static const uInt16 _console_font_bits[] = { /* Character 75 (0x4b): width 8 + bbx ( 8, 13, 0, -2 ) + +--------+ | | | | @@ -1546,6 +1612,8 @@ static const uInt16 _console_font_bits[] = { /* Character 76 (0x4c): width 8 + bbx ( 8, 13, 0, -2 ) + +--------+ | | | | @@ -1578,6 +1646,8 @@ static const uInt16 _console_font_bits[] = { /* Character 77 (0x4d): width 8 + bbx ( 8, 13, 0, -2 ) + +--------+ | | | | @@ -1610,6 +1680,8 @@ static const uInt16 _console_font_bits[] = { /* Character 78 (0x4e): width 8 + bbx ( 8, 13, 0, -2 ) + +--------+ | | | | @@ -1642,6 +1714,8 @@ static const uInt16 _console_font_bits[] = { /* Character 79 (0x4f): width 8 + bbx ( 8, 13, 0, -2 ) + +--------+ | | | | @@ -1674,6 +1748,8 @@ static const uInt16 _console_font_bits[] = { /* Character 80 (0x50): width 8 + bbx ( 8, 13, 0, -2 ) + +--------+ | | | | @@ -1706,6 +1782,8 @@ static const uInt16 _console_font_bits[] = { /* Character 81 (0x51): width 8 + bbx ( 8, 13, 0, -2 ) + +--------+ | | | | @@ -1738,6 +1816,8 @@ static const uInt16 _console_font_bits[] = { /* Character 82 (0x52): width 8 + bbx ( 8, 13, 0, -2 ) + +--------+ | | | | @@ -1770,6 +1850,8 @@ static const uInt16 _console_font_bits[] = { /* Character 83 (0x53): width 8 + bbx ( 8, 13, 0, -2 ) + +--------+ | | | | @@ -1802,6 +1884,8 @@ static const uInt16 _console_font_bits[] = { /* Character 84 (0x54): width 8 + bbx ( 8, 13, 0, -2 ) + +--------+ | | | | @@ -1834,6 +1918,8 @@ static const uInt16 _console_font_bits[] = { /* Character 85 (0x55): width 8 + bbx ( 8, 13, 0, -2 ) + +--------+ | | | | @@ -1866,6 +1952,8 @@ static const uInt16 _console_font_bits[] = { /* Character 86 (0x56): width 8 + bbx ( 8, 13, 0, -2 ) + +--------+ | | | | @@ -1898,6 +1986,8 @@ static const uInt16 _console_font_bits[] = { /* Character 87 (0x57): width 8 + bbx ( 8, 13, 0, -2 ) + +--------+ | | | | @@ -1930,6 +2020,8 @@ static const uInt16 _console_font_bits[] = { /* Character 88 (0x58): width 8 + bbx ( 8, 13, 0, -2 ) + +--------+ | | | | @@ -1962,6 +2054,8 @@ static const uInt16 _console_font_bits[] = { /* Character 89 (0x59): width 8 + bbx ( 8, 13, 0, -2 ) + +--------+ | | | | @@ -1994,6 +2088,8 @@ static const uInt16 _console_font_bits[] = { /* Character 90 (0x5a): width 8 + bbx ( 8, 13, 0, -2 ) + +--------+ | | | | @@ -2026,6 +2122,8 @@ static const uInt16 _console_font_bits[] = { /* Character 91 (0x5b): width 8 + bbx ( 8, 13, 0, -2 ) + +--------+ | | | | @@ -2058,6 +2156,8 @@ static const uInt16 _console_font_bits[] = { /* Character 92 (0x5c): width 8 + bbx ( 8, 13, 0, -2 ) + +--------+ | | | | @@ -2090,6 +2190,8 @@ static const uInt16 _console_font_bits[] = { /* Character 93 (0x5d): width 8 + bbx ( 8, 13, 0, -2 ) + +--------+ | | | | @@ -2122,6 +2224,8 @@ static const uInt16 _console_font_bits[] = { /* Character 94 (0x5e): width 8 + bbx ( 8, 13, 0, -2 ) + +--------+ | | | | @@ -2154,6 +2258,8 @@ static const uInt16 _console_font_bits[] = { /* Character 95 (0x5f): width 8 + bbx ( 8, 13, 0, -2 ) + +--------+ | | | | @@ -2186,6 +2292,8 @@ static const uInt16 _console_font_bits[] = { /* Character 96 (0x60): width 8 + bbx ( 8, 13, 0, -2 ) + +--------+ | | | * | @@ -2218,6 +2326,8 @@ static const uInt16 _console_font_bits[] = { /* Character 97 (0x61): width 8 + bbx ( 8, 13, 0, -2 ) + +--------+ | | | | @@ -2250,6 +2360,8 @@ static const uInt16 _console_font_bits[] = { /* Character 98 (0x62): width 8 + bbx ( 8, 13, 0, -2 ) + +--------+ | | | | @@ -2282,6 +2394,8 @@ static const uInt16 _console_font_bits[] = { /* Character 99 (0x63): width 8 + bbx ( 8, 13, 0, -2 ) + +--------+ | | | | @@ -2314,6 +2428,8 @@ static const uInt16 _console_font_bits[] = { /* Character 100 (0x64): width 8 + bbx ( 8, 13, 0, -2 ) + +--------+ | | | | @@ -2346,6 +2462,8 @@ static const uInt16 _console_font_bits[] = { /* Character 101 (0x65): width 8 + bbx ( 8, 13, 0, -2 ) + +--------+ | | | | @@ -2378,6 +2496,8 @@ static const uInt16 _console_font_bits[] = { /* Character 102 (0x66): width 8 + bbx ( 8, 13, 0, -2 ) + +--------+ | | | | @@ -2410,6 +2530,8 @@ static const uInt16 _console_font_bits[] = { /* Character 103 (0x67): width 8 + bbx ( 8, 13, 0, -2 ) + +--------+ | | | | @@ -2442,6 +2564,8 @@ static const uInt16 _console_font_bits[] = { /* Character 104 (0x68): width 8 + bbx ( 8, 13, 0, -2 ) + +--------+ | | | | @@ -2474,6 +2598,8 @@ static const uInt16 _console_font_bits[] = { /* Character 105 (0x69): width 8 + bbx ( 8, 13, 0, -2 ) + +--------+ | | | | @@ -2506,6 +2632,8 @@ static const uInt16 _console_font_bits[] = { /* Character 106 (0x6a): width 8 + bbx ( 8, 13, 0, -2 ) + +--------+ | | | | @@ -2538,6 +2666,8 @@ static const uInt16 _console_font_bits[] = { /* Character 107 (0x6b): width 8 + bbx ( 8, 13, 0, -2 ) + +--------+ | | | | @@ -2570,6 +2700,8 @@ static const uInt16 _console_font_bits[] = { /* Character 108 (0x6c): width 8 + bbx ( 8, 13, 0, -2 ) + +--------+ | | | | @@ -2602,6 +2734,8 @@ static const uInt16 _console_font_bits[] = { /* Character 109 (0x6d): width 8 + bbx ( 8, 13, 0, -2 ) + +--------+ | | | | @@ -2634,6 +2768,8 @@ static const uInt16 _console_font_bits[] = { /* Character 110 (0x6e): width 8 + bbx ( 8, 13, 0, -2 ) + +--------+ | | | | @@ -2666,6 +2802,8 @@ static const uInt16 _console_font_bits[] = { /* Character 111 (0x6f): width 8 + bbx ( 8, 13, 0, -2 ) + +--------+ | | | | @@ -2698,6 +2836,8 @@ static const uInt16 _console_font_bits[] = { /* Character 112 (0x70): width 8 + bbx ( 8, 13, 0, -2 ) + +--------+ | | | | @@ -2730,6 +2870,8 @@ static const uInt16 _console_font_bits[] = { /* Character 113 (0x71): width 8 + bbx ( 8, 13, 0, -2 ) + +--------+ | | | | @@ -2762,6 +2904,8 @@ static const uInt16 _console_font_bits[] = { /* Character 114 (0x72): width 8 + bbx ( 8, 13, 0, -2 ) + +--------+ | | | | @@ -2794,6 +2938,8 @@ static const uInt16 _console_font_bits[] = { /* Character 115 (0x73): width 8 + bbx ( 8, 13, 0, -2 ) + +--------+ | | | | @@ -2826,6 +2972,8 @@ static const uInt16 _console_font_bits[] = { /* Character 116 (0x74): width 8 + bbx ( 8, 13, 0, -2 ) + +--------+ | | | | @@ -2858,6 +3006,8 @@ static const uInt16 _console_font_bits[] = { /* Character 117 (0x75): width 8 + bbx ( 8, 13, 0, -2 ) + +--------+ | | | | @@ -2890,6 +3040,8 @@ static const uInt16 _console_font_bits[] = { /* Character 118 (0x76): width 8 + bbx ( 8, 13, 0, -2 ) + +--------+ | | | | @@ -2922,6 +3074,8 @@ static const uInt16 _console_font_bits[] = { /* Character 119 (0x77): width 8 + bbx ( 8, 13, 0, -2 ) + +--------+ | | | | @@ -2954,6 +3108,8 @@ static const uInt16 _console_font_bits[] = { /* Character 120 (0x78): width 8 + bbx ( 8, 13, 0, -2 ) + +--------+ | | | | @@ -2986,6 +3142,8 @@ static const uInt16 _console_font_bits[] = { /* Character 121 (0x79): width 8 + bbx ( 8, 13, 0, -2 ) + +--------+ | | | | @@ -3018,6 +3176,8 @@ static const uInt16 _console_font_bits[] = { /* Character 122 (0x7a): width 8 + bbx ( 8, 13, 0, -2 ) + +--------+ | | | | @@ -3050,6 +3210,8 @@ static const uInt16 _console_font_bits[] = { /* Character 123 (0x7b): width 8 + bbx ( 8, 13, 0, -2 ) + +--------+ | | | | @@ -3082,6 +3244,8 @@ static const uInt16 _console_font_bits[] = { /* Character 124 (0x7c): width 8 + bbx ( 8, 13, 0, -2 ) + +--------+ | | | | @@ -3114,6 +3278,8 @@ static const uInt16 _console_font_bits[] = { /* Character 125 (0x7d): width 8 + bbx ( 8, 13, 0, -2 ) + +--------+ | | | | @@ -3146,6 +3312,8 @@ static const uInt16 _console_font_bits[] = { /* Character 126 (0x7e): width 8 + bbx ( 8, 13, 0, -2 ) + +--------+ | | | | @@ -3174,155 +3342,24 @@ static const uInt16 _console_font_bits[] = { 0x0000, 0x0000, 0x0000, -0x0000 -}; - -/* Character->glyph mapping. */ -static const uInt32 _console_sysfont_offset[] = { - 39, /* (0x00) */ - 0, /* (0x01) */ - 0, /* (0x02) */ - 0, /* (0x03) */ - 0, /* (0x04) */ - 0, /* (0x05) */ - 0, /* (0x06) */ - 0, /* (0x07) */ - 0, /* (0x08) */ - 0, /* (0x09) */ - 0, /* (0x0a) */ - 0, /* (0x0b) */ - 0, /* (0x0c) */ - 0, /* (0x0d) */ - 0, /* (0x0e) */ - 0, /* (0x0f) */ - 0, /* (0x10) */ - 0, /* (0x11) */ - 0, /* (0x12) */ - 0, /* (0x13) */ - 0, /* (0x14) */ - 0, /* (0x15) */ - 0, /* (0x16) */ - 0, /* (0x17) */ - 0, /* (0x18) */ - 0, /* (0x19) */ - 0, /* (0x1a) */ - 0, /* (0x1b) */ - 0, /* (0x1c) */ - 0, /* (0x1d) */ - 13, /* (0x1e) */ - 26, /* (0x1f) */ - 39, /* (0x20) */ - 52, /* (0x21) */ - 65, /* (0x22) */ - 78, /* (0x23) */ - 91, /* (0x24) */ - 104, /* (0x25) */ - 117, /* (0x26) */ - 130, /* (0x27) */ - 143, /* (0x28) */ - 156, /* (0x29) */ - 169, /* (0x2a) */ - 182, /* (0x2b) */ - 195, /* (0x2c) */ - 208, /* (0x2d) */ - 221, /* (0x2e) */ - 234, /* (0x2f) */ - 247, /* (0x30) */ - 260, /* (0x31) */ - 273, /* (0x32) */ - 286, /* (0x33) */ - 299, /* (0x34) */ - 312, /* (0x35) */ - 325, /* (0x36) */ - 338, /* (0x37) */ - 351, /* (0x38) */ - 364, /* (0x39) */ - 377, /* (0x3a) */ - 390, /* (0x3b) */ - 403, /* (0x3c) */ - 416, /* (0x3d) */ - 429, /* (0x3e) */ - 442, /* (0x3f) */ - 455, /* (0x40) */ - 468, /* (0x41) */ - 481, /* (0x42) */ - 494, /* (0x43) */ - 507, /* (0x44) */ - 520, /* (0x45) */ - 533, /* (0x46) */ - 546, /* (0x47) */ - 559, /* (0x48) */ - 572, /* (0x49) */ - 585, /* (0x4a) */ - 598, /* (0x4b) */ - 611, /* (0x4c) */ - 624, /* (0x4d) */ - 637, /* (0x4e) */ - 650, /* (0x4f) */ - 663, /* (0x50) */ - 676, /* (0x51) */ - 689, /* (0x52) */ - 702, /* (0x53) */ - 715, /* (0x54) */ - 728, /* (0x55) */ - 741, /* (0x56) */ - 754, /* (0x57) */ - 767, /* (0x58) */ - 780, /* (0x59) */ - 793, /* (0x5a) */ - 806, /* (0x5b) */ - 819, /* (0x5c) */ - 832, /* (0x5d) */ - 845, /* (0x5e) */ - 858, /* (0x5f) */ - 871, /* (0x60) */ - 884, /* (0x61) */ - 897, /* (0x62) */ - 910, /* (0x63) */ - 923, /* (0x64) */ - 936, /* (0x65) */ - 949, /* (0x66) */ - 962, /* (0x67) */ - 975, /* (0x68) */ - 988, /* (0x69) */ - 1001, /* (0x6a) */ - 1014, /* (0x6b) */ - 1027, /* (0x6c) */ - 1040, /* (0x6d) */ - 1053, /* (0x6e) */ - 1066, /* (0x6f) */ - 1079, /* (0x70) */ - 1092, /* (0x71) */ - 1105, /* (0x72) */ - 1118, /* (0x73) */ - 1131, /* (0x74) */ - 1144, /* (0x75) */ - 1157, /* (0x76) */ - 1170, /* (0x77) */ - 1183, /* (0x78) */ - 1196, /* (0x79) */ - 1209, /* (0x7a) */ - 1222, /* (0x7b) */ - 1235, /* (0x7c) */ - 1248, /* (0x7d) */ - 1261 /* (0x7e) */ +0x0000, }; +/* Exported structure definition. */ static const FontDesc consoleDesc = { - "8x13", /* font name */ - 8, /* max width in pixels */ - 13, /* height in pixels */ - 8, 13, 0, -1, /* max bounding box */ - 11, /* ascent (baseline) height */ - 0, /* first character in bitmap */ - 127, /* font size in glyphs */ - _console_font_bits, /* 16-bit right-padded bitmap data */ - _console_sysfont_offset, /* offsets into bitmap data*/ - 0, /* fixed width*/ /* character widths or NULL if fixed */ - 0, /* character bounding box or NULL if fixed */ - 0, /* default char (not glyph index) */ - sizeof(_console_font_bits)/sizeof(uInt16) /* # words of bitmap_t bits */ - + "8x13-ISO8859-1", + 8, + 13, + 8, 13, 0, -2, + 11, + 30, + 97, + console_font_bits, + 0, /* no encode table*/ + 0, /* fixed width*/ + 0, /* fixed bbox*/ + 32, // Originally 30 + sizeof(console_font_bits)/sizeof(uInt16) }; } // End of namespace GUI diff --git a/src/gui/EditTextWidget.cxx b/src/gui/EditTextWidget.cxx index 658c50cce..ea7039408 100644 --- a/src/gui/EditTextWidget.cxx +++ b/src/gui/EditTextWidget.cxx @@ -28,7 +28,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - EditTextWidget::EditTextWidget(GuiObject* boss, const GUI::Font& font, int x, int y, int w, int h, const string& text) - : EditableWidget(boss, font, x, y - 1, w, h + 2, text), + : EditableWidget(boss, font, x, y, w, h + 2, text), _editable(true), _changed(false) { diff --git a/src/gui/EditableWidget.cxx b/src/gui/EditableWidget.cxx index 6b7ca69cd..f5cbda353 100644 --- a/src/gui/EditableWidget.cxx +++ b/src/gui/EditableWidget.cxx @@ -200,7 +200,7 @@ void EditableWidget::drawCaret() y += _y; FBSurface& s = _boss->dialog().surface(); - s.vLine(x, y+2, y + editRect.height() - 3, kTextColorHi); + s.vLine(x, y+2, y + editRect.height() - 2, kTextColorHi); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/gui/StellaFont.hxx b/src/gui/StellaFont.hxx index 681f5ea8c..2db6a8f98 100644 --- a/src/gui/StellaFont.hxx +++ b/src/gui/StellaFont.hxx @@ -1,8 +1,8 @@ //============================================================================ // -// SSSS tt lll lll -// SS SS tt ll ll -// SS tttttt eeee ll ll aaaa +// SSSS tt lll lll +// SS SS tt ll ll +// SS tttttt eeee ll ll aaaa // SSSS tt ee ee ll ll aa // SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator" // SS SS tt ee ll ll aa aa @@ -15,18 +15,17 @@ // this file, and for a DISCLAIMER OF ALL WARRANTIES. // // $Id$ +// +// Generated by src/tools/convbdf on Wed Jul 31 13:02:19 2013. //============================================================================ #ifndef STELLA_FONT_DATA_HXX #define STELLA_FONT_DATA_HXX #include "Font.hxx" -#include "bspf.hxx" - -namespace GUI { /* Font information: - name: s_6x10 + name: 6x10-ISO8859-1 facename: -Misc-Fixed-Medium-R-Normal--10-100-75-75-C-60-ISO8859-1 w x h: 6x10 bbx: 6 10 0 -2 @@ -40,8 +39,10 @@ namespace GUI { Public domain terminal emulator font. Share and enjoy. */ -/* Font character bitmap data. */ -static const uInt16 _stella_font_bits[] = { +namespace GUI { + +// Font character bitmap data. +static const uInt16 stella_font_bits[] = { /* Character 32 (0x20): width 6 @@ -2706,21 +2707,21 @@ static const uInt16 _stella_font_bits[] = { /* Exported structure definition. */ static const FontDesc stellaDesc = { - "s_6x10", - 6, - 10, - 6, 10, 0, -2, - 8, - 32, - 95, - _stella_font_bits, - 0, /* no encode table*/ - 0, /* fixed width*/ - 0, /* fixed bbox*/ - 32, - sizeof(_stella_font_bits)/sizeof(uInt16) + "6x10-ISO8859-1", + 6, + 10, + 6, 10, 0, -2, + 8, + 32, + 95, + stella_font_bits, + 0, /* no encode table*/ + 0, /* fixed width*/ + 0, /* fixed bbox*/ + 32, + sizeof(stella_font_bits)/sizeof(uInt16) }; -} // namespace GUI +} // End of namespace GUI #endif diff --git a/src/gui/StellaLargeFont.hxx b/src/gui/StellaLargeFont.hxx index 9bbf48de7..67e482114 100644 --- a/src/gui/StellaLargeFont.hxx +++ b/src/gui/StellaLargeFont.hxx @@ -1,8 +1,8 @@ //============================================================================ // -// SSSS tt lll lll -// SS SS tt ll ll -// SS tttttt eeee ll ll aaaa +// SSSS tt lll lll +// SS SS tt ll ll +// SS tttttt eeee ll ll aaaa // SSSS tt ee ee ll ll aa // SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator" // SS SS tt ee ll ll aa aa @@ -15,18 +15,17 @@ // this file, and for a DISCLAIMER OF ALL WARRANTIES. // // $Id$ +// +// Generated by src/tools/convbdf on Wed Jul 31 13:06:48 2013. //============================================================================ #ifndef STELLALARGE_FONT_DATA_HXX #define STELLALARGE_FONT_DATA_HXX #include "Font.hxx" -#include "bspf.hxx" - -namespace GUI { /* Font information: - name: l_10x20 + name: 10x20-ISO8859-1 facename: -Misc-Fixed-Medium-R-Normal--20-200-75-75-C-100-ISO8859-1 w x h: 10x20 bbx: 10 20 0 -4 @@ -40,8 +39,10 @@ namespace GUI { Public domain font. Share and enjoy. */ -/* Font character bitmap data. */ -static const uInt16 _stellaLarge_font_bits[] = { +namespace GUI { + +// Font character bitmap data. +static const uInt16 stellaLarge_font_bits[] = { /* Character 32 (0x20): width 10 @@ -4606,21 +4607,21 @@ static const uInt16 _stellaLarge_font_bits[] = { /* Exported structure definition. */ static const FontDesc stellaLargeDesc = { - "l_10x20", - 10, - 20, - 10, 20, 0, -4, - 16, - 32, - 95, - _stellaLarge_font_bits, - 0, /* no encode table*/ - 0, /* fixed width*/ - 0, /* fixed bbox*/ - 32, - sizeof(_stellaLarge_font_bits)/sizeof(uInt16) + "10x20-ISO8859-1", + 10, + 20, + 10, 20, 0, -4, + 16, + 32, + 95, + stellaLarge_font_bits, + 0, /* no encode table*/ + 0, /* fixed width*/ + 0, /* fixed bbox*/ + 32, + sizeof(stellaLarge_font_bits)/sizeof(uInt16) }; -} // namespace GUI +} // End of namespace GUI #endif diff --git a/src/gui/StellaMediumFont.hxx b/src/gui/StellaMediumFont.hxx index 03bde9847..ee553bacd 100644 --- a/src/gui/StellaMediumFont.hxx +++ b/src/gui/StellaMediumFont.hxx @@ -1,8 +1,8 @@ //============================================================================ // -// SSSS tt lll lll -// SS SS tt ll ll -// SS tttttt eeee ll ll aaaa +// SSSS tt lll lll +// SS SS tt ll ll +// SS tttttt eeee ll ll aaaa // SSSS tt ee ee ll ll aa // SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator" // SS SS tt ee ll ll aa aa @@ -15,18 +15,17 @@ // this file, and for a DISCLAIMER OF ALL WARRANTIES. // // $Id$ +// +// Generated by src/tools/convbdf on Wed Jul 31 12:59:06 2013. //============================================================================ -#ifndef STELLA_MEDIUM_FONT_DATA_HXX -#define STELLA_MEDIUM_FONT_DATA_HXX +#ifndef STELLAMEDIUM_FONT_DATA_HXX +#define STELLAMEDIUM_FONT_DATA_HXX #include "Font.hxx" -#include "bspf.hxx" - -namespace GUI { /* Font information: - name: m_9x18b + name: 9x18B-ISO8859-1 facename: -Misc-Fixed-Bold-R-Normal--18-120-100-100-C-90-ISO8859-1 w x h: 9x18 bbx: 9 18 0 -4 @@ -40,8 +39,10 @@ namespace GUI { Public domain font. Share and enjoy. */ -/* Font character bitmap data. */ -static const uInt16 _stella_medium_font_bits[] = { +namespace GUI { + +// Font character bitmap data. +static const uInt16 stellaMedium_font_bits[] = { /* Character 32 (0x20): width 9 @@ -4226,21 +4227,21 @@ static const uInt16 _stella_medium_font_bits[] = { /* Exported structure definition. */ static const FontDesc stellaMediumDesc = { - "m_9x18b", - 9, - 18, - 9, 18, 0, -4, - 14, - 32, - 95, - _stella_medium_font_bits, - 0, /* no encode table*/ - 0, /* fixed width*/ - 0, /* fixed bbox*/ - 32, - sizeof(_stella_medium_font_bits)/sizeof(uInt16) + "9x18B-ISO8859-1", + 9, + 18, + 9, 18, 0, -4, + 14, + 32, + 95, + stellaMedium_font_bits, + 0, /* no encode table*/ + 0, /* fixed width*/ + 0, /* fixed bbox*/ + 32, + sizeof(stellaMedium_font_bits)/sizeof(uInt16) }; -} // namespace GUI +} // End of namespace GUI #endif diff --git a/src/tools/convbdf.c b/src/tools/convbdf.c new file mode 100644 index 000000000..c09570bfc --- /dev/null +++ b/src/tools/convbdf.c @@ -0,0 +1,989 @@ +/* + * Convert BDF files to C++ source. + * + * Copyright (c) 2002 by Greg Haerr + * + * Originally writen for the Microwindows Project + * + * Greg then modified it for Rockbox + * + * Max Horn took that version and changed it to work for ScummVM. + * Changes include: warning fixes, removed .FNT output, output C++ source, + * tweak code generator so that the generated code fits into ScummVM code base. + * + * What fun it is converting font data... + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $Id$ + * + */ +#include +#include +#include +#include +#include + +int READ_UINT16(void *addr) { + unsigned char *buf = addr; + return (buf[0] << 8) | buf[1]; +} + +void WRITE_UINT16(void *addr, int value) { + unsigned char *buf = addr; + buf[0] = (value >> 8) & 0xFF; + buf[1] = value & 0xFF; +} + +/* BEGIN font.h*/ +/* uInt16 helper macros*/ +#define BITMAP_WORDS(x) (((x)+15)/16) /* image size in words*/ +#define BITMAP_BYTES(x) (BITMAP_WORDS(x)*sizeof(uInt16)) +#define BITMAP_BITSPERIMAGE (sizeof(uInt16) * 8) +#define BITMAP_BITVALUE(n) ((uInt16) (((uInt16) 1) << (n))) +#define BITMAP_FIRSTBIT (BITMAP_BITVALUE(BITMAP_BITSPERIMAGE - 1)) +#define BITMAP_TESTBIT(m) ((m) & BITMAP_FIRSTBIT) +#define BITMAP_SHIFTBIT(m) ((uInt16) ((m) << 1)) + +typedef unsigned short uInt16; /* bitmap image unit size*/ + +typedef struct { + signed char w; + signed char h; + signed char x; + signed char y; +} BBX; + +/* builtin C-based proportional/fixed font structure */ +/* based on The Microwindows Project http://microwindows.org */ +struct font { + char * name; /* font name*/ + int maxwidth; /* max width in pixels*/ + int height; /* height in pixels*/ + int fbbw, fbbh, fbbx, fbby; /* max bounding box */ + int ascent; /* ascent (baseline) height*/ + int firstchar; /* first character in bitmap*/ + int size; /* font size in glyphs*/ + uInt16* bits; /* 16-bit right-padded bitmap data*/ + unsigned long* offset; /* offsets into bitmap data*/ + unsigned char* width; /* character widths or NULL if fixed*/ + BBX* bbx; /* character bounding box or NULL if fixed*/ + int defaultchar; /* default char (not glyph index)*/ + long bits_size; /* # words of uInt16 bits*/ + + /* unused by runtime system, read in by convbdf*/ + char * facename; /* facename of font*/ + char * copyright; /* copyright info for loadable fonts*/ + int pixel_size; + int descent; +}; +/* END font.h*/ + +#define isprefix(buf,str) (!strncmp(buf, str, strlen(str))) +#define strequal(s1,s2) (!strcmp(s1, s2)) + +#define EXTRA 300 /* # bytes extra allocation for buggy .bdf files*/ + +int gen_map = 1; +int start_char = 0; +int limit_char = 65535; +int oflag = 0; +char outfile[256]; +char fontname[256]; +char fontnameU[256]; + +void usage(void); +void getopts(int *pac, char ***pav); +int convbdf(char *path); + +void free_font(struct font* pf); +struct font* bdf_read_font(char *path); +int bdf_read_header(FILE *fp, struct font* pf); +int bdf_read_bitmaps(FILE *fp, struct font* pf); +char * bdf_getline(FILE *fp, char *buf, int len); +uInt16 bdf_hexval(unsigned char *buf); + +int gen_c_source(struct font* pf, char *path); + +void error(const char *s, ...) { + char buf[1024]; + va_list va; + + va_start(va, s); + vsnprintf(buf, 1024, s, va); + va_end(va); + + fprintf(stderr, "ERROR: %s!\n", buf); + + exit(1); +} + +void warning(const char *s, ...) { + char buf[1024]; + va_list va; + + va_start(va, s); + vsnprintf(buf, 1024, s, va); + va_end(va); + + fprintf(stderr, "WARNING: %s!\n", buf); +} + +void +usage(void) +{ + char help[] = { + "Usage: convbdf [options] [input-files]\n" + " convbdf [options] [-o output-file] [single-input-file]\n" + "Options:\n" + " -s N Start output at character encodings >= N\n" + " -l N Limit output to character encodings <= N\n" + " -f N Name to use for the font in the C++ code\n" + " -n Don't generate bitmaps as comments in .c file\n" + }; + + fprintf(stderr, "%s", help); +} + +/* parse command line options*/ +void getopts(int *pac, char ***pav) +{ + const char *p; + char **av; + int ac; + + outfile[0] = '\0'; + fontname[0] = '\0'; + fontnameU[0] = '\0'; + + ac = *pac; + av = *pav; + while (ac > 0 && av[0][0] == '-') { + p = &av[0][1]; + while (*p) { + switch (*p++) { + case ' ': /* multiple -args on av[]*/ + while (*p && *p == ' ') + p++; + if (*p++ != '-') /* next option must have dash*/ + p = ""; + break; /* proceed to next option*/ + case 'n': /* don't gen bitmap comments*/ + gen_map = 0; + break; + case 'o': /* set output file*/ + oflag = 1; + if (*p) { + strcpy(outfile, p); + while (*p && *p != ' ') + p++; + } + else { + av++; ac--; + if (ac > 0) + strcpy(outfile, av[0]); + } + break; + case 'l': /* set encoding limit*/ + if (*p) { + limit_char = atoi(p); + while (*p && *p != ' ') + p++; + } + else { + av++; ac--; + if (ac > 0) + limit_char = atoi(av[0]); + } + break; + case 's': /* set encoding start*/ + if (*p) { + start_char = atoi(p); + while (*p && *p != ' ') + p++; + } + else { + av++; ac--; + if (ac > 0) + start_char = atoi(av[0]); + } + break; + case 'f': /* set font name*/ + if (*p) { + strcpy(fontname, p); + while (*p && *p != ' ') + p++; + } + else { + av++; ac--; + if (ac > 0) + strcpy(fontname, av[0]); + } + { + char* u; + strcpy(fontnameU, fontname); + u = fontnameU; + while(*u++=toupper(*u)) + ; + } + break; + default: + fprintf(stderr, "Unknown option ignored: %c\r\n", *(p-1)); + } + } + ++av; --ac; + } + *pac = ac; + *pav = av; +} + +/* remove directory prefix and file suffix from full path*/ +char *basename(char *path) +{ + char *p, *b; + static char base[256]; + + /* remove prepended path and extension*/ + b = path; + for (p = path; *p; ++p) { + if (*p == '/') + b = p + 1; + } + strcpy(base, b); + for (p = base; *p; ++p) { + if (*p == '.') { + *p = 0; + break; + } + } + return base; +} + +int convbdf(char *path) +{ + struct font* pf; + int ret = 0; + + pf = bdf_read_font(path); + if (!pf) + exit(1); + + if (!oflag) { + strcpy(outfile, basename(path)); + strcat(outfile, ".hxx"); + } + ret |= gen_c_source(pf, outfile); + + free_font(pf); + return ret; +} + +int main(int ac, char *av[]) +{ + int ret = 0; + + ++av; --ac; /* skip av[0]*/ + getopts(&ac, &av); /* read command line options*/ + + if (ac < 1) { + usage(); + exit(1); + } + if (oflag && ac > 1) { + usage(); + exit(1); + } + + while (ac > 0) { + ret |= convbdf(av[0]); + ++av; --ac; + } + + exit(ret); +} + +/* free font structure*/ +void free_font(struct font* pf) +{ + if (!pf) + return; + free(pf->name); + free(pf->facename); + free(pf->bits); + free(pf->offset); + free(pf->width); + free(pf); +} + +/* build incore structure from .bdf file*/ +struct font* bdf_read_font(char *path) +{ + FILE *fp; + struct font* pf; + + fp = fopen(path, "rb"); + if (!fp) { + fprintf(stderr, "Error opening file: %s\n", path); + return NULL; + } + + pf = (struct font*)calloc(1, sizeof(struct font)); + if (!pf) + goto errout; + + pf->name = strdup(basename(path)); + + if (!bdf_read_header(fp, pf)) { + fprintf(stderr, "Error reading font header\n"); + goto errout; + } + + if (!bdf_read_bitmaps(fp, pf)) { + fprintf(stderr, "Error reading font bitmaps\n"); + goto errout; + } + + fclose(fp); + return pf; + + errout: + fclose(fp); + free_font(pf); + return NULL; +} + +/* read bdf font header information, return 0 on error*/ +int bdf_read_header(FILE *fp, struct font* pf) +{ + int encoding; + int nchars, maxwidth; + int firstchar = 65535; + int lastchar = -1; + char buf[256]; + char facename[256]; + char copyright[256]; + + /* set certain values to errors for later error checking*/ + pf->defaultchar = -1; + pf->ascent = -1; + pf->descent = -1; + + for (;;) { + if (!bdf_getline(fp, buf, sizeof(buf))) { + fprintf(stderr, "Error: EOF on file\n"); + return 0; + } + if (isprefix(buf, "FONT ")) { /* not required*/ + if (sscanf(buf, "FONT %[^\n]", facename) != 1) { + fprintf(stderr, "Error: bad 'FONT'\n"); + return 0; + } + pf->facename = strdup(facename); + continue; + } + if (isprefix(buf, "COPYRIGHT ")) { /* not required*/ + if (sscanf(buf, "COPYRIGHT \"%[^\"]", copyright) != 1) { + fprintf(stderr, "Error: bad 'COPYRIGHT'\n"); + return 0; + } + pf->copyright = strdup(copyright); + continue; + } + if (isprefix(buf, "DEFAULT_CHAR ")) { /* not required*/ + if (sscanf(buf, "DEFAULT_CHAR %d", &pf->defaultchar) != 1) { + fprintf(stderr, "Error: bad 'DEFAULT_CHAR'\n"); + return 0; + } + } + if (isprefix(buf, "FONT_DESCENT ")) { + if (sscanf(buf, "FONT_DESCENT %d", &pf->descent) != 1) { + fprintf(stderr, "Error: bad 'FONT_DESCENT'\n"); + return 0; + } + continue; + } + if (isprefix(buf, "FONT_ASCENT ")) { + if (sscanf(buf, "FONT_ASCENT %d", &pf->ascent) != 1) { + fprintf(stderr, "Error: bad 'FONT_ASCENT'\n"); + return 0; + } + continue; + } + if (isprefix(buf, "FONTBOUNDINGBOX ")) { + if (sscanf(buf, "FONTBOUNDINGBOX %d %d %d %d", + &pf->fbbw, &pf->fbbh, &pf->fbbx, &pf->fbby) != 4) { + fprintf(stderr, "Error: bad 'FONTBOUNDINGBOX'\n"); + return 0; + } + continue; + } + if (isprefix(buf, "CHARS ")) { + if (sscanf(buf, "CHARS %d", &nchars) != 1) { + fprintf(stderr, "Error: bad 'CHARS'\n"); + return 0; + } + continue; + } + + /* + * Reading ENCODING is necessary to get firstchar/lastchar + * which is needed to pre-calculate our offset and widths + * array sizes. + */ + if (isprefix(buf, "ENCODING ")) { + if (sscanf(buf, "ENCODING %d", &encoding) != 1) { + fprintf(stderr, "Error: bad 'ENCODING'\n"); + return 0; + } + if (encoding >= 0 && + encoding <= limit_char && + encoding >= start_char) { + + if (firstchar > encoding) + firstchar = encoding; + if (lastchar < encoding) + lastchar = encoding; + } + continue; + } + if (strequal(buf, "ENDFONT")) + break; + } + + /* calc font height*/ + if (pf->ascent < 0 || pf->descent < 0 || firstchar < 0) { + fprintf(stderr, "Error: Invalid BDF file, requires FONT_ASCENT/FONT_DESCENT/ENCODING\n"); + return 0; + } + pf->height = pf->ascent + pf->descent; + + /* calc default char*/ + if (pf->defaultchar < 0 || + pf->defaultchar < firstchar || + pf->defaultchar > limit_char ) + pf->defaultchar = firstchar; + + /* calc font size (offset/width entries)*/ + pf->firstchar = firstchar; + pf->size = lastchar - firstchar + 1; + + /* use the font boundingbox to get initial maxwidth*/ + /*maxwidth = pf->fbbw - pf->fbbx;*/ + maxwidth = pf->fbbw; + + /* initially use font maxwidth * height for bits allocation*/ + pf->bits_size = nchars * BITMAP_WORDS(maxwidth) * pf->height; + + /* allocate bits, offset, and width arrays*/ + pf->bits = (uInt16 *)malloc(pf->bits_size * sizeof(uInt16) + EXTRA); + pf->offset = (unsigned long *)malloc(pf->size * sizeof(unsigned long)); + pf->width = (unsigned char *)malloc(pf->size * sizeof(unsigned char)); + pf->bbx = (BBX *)malloc(pf->size * sizeof(BBX)); + + if (!pf->bits || !pf->offset || !pf->width) { + fprintf(stderr, "Error: no memory for font load\n"); + return 0; + } + + return 1; +} + +/* read bdf font bitmaps, return 0 on error*/ +int bdf_read_bitmaps(FILE *fp, struct font* pf) +{ + long ofs = 0; + int maxwidth = 0; + int i, k, encoding, width; + int bbw, bbh, bbx, bby; + int proportional = 0; + int need_bbx = 0; + int encodetable = 0; + long l; + char buf[256]; + + /* reset file pointer*/ + fseek(fp, 0L, SEEK_SET); + + /* initially mark offsets as not used*/ + for (i = 0; i < pf->size; ++i) + pf->offset[i] = -1; + + for (;;) { + if (!bdf_getline(fp, buf, sizeof(buf))) { + fprintf(stderr, "Error: EOF on file\n"); + return 0; + } + if (isprefix(buf, "STARTCHAR")) { + encoding = width = bbw = bbh = bbx = bby = -1; + continue; + } + if (isprefix(buf, "ENCODING ")) { + if (sscanf(buf, "ENCODING %d", &encoding) != 1) { + fprintf(stderr, "Error: bad 'ENCODING'\n"); + return 0; + } + if (encoding < start_char || encoding > limit_char) + encoding = -1; + continue; + } + if (isprefix(buf, "DWIDTH ")) { + if (sscanf(buf, "DWIDTH %d", &width) != 1) { + fprintf(stderr, "Error: bad 'DWIDTH'\n"); + return 0; + } + /* use font boundingbox width if DWIDTH <= 0*/ + if (width <= 0) + width = pf->fbbw - pf->fbbx; + continue; + } + if (isprefix(buf, "BBX ")) { + if (sscanf(buf, "BBX %d %d %d %d", &bbw, &bbh, &bbx, &bby) != 4) { + fprintf(stderr, "Error: bad 'BBX'\n"); + return 0; + } + continue; + } + if (strequal(buf, "BITMAP")) { + uInt16 *ch_bitmap = pf->bits + ofs; + int ch_words; + + if (encoding < 0) + continue; + + /* set bits offset in encode map*/ + if (pf->offset[encoding-pf->firstchar] != (unsigned long)-1) { + fprintf(stderr, "Error: duplicate encoding for character %d (0x%02x), ignoring duplicate\n", + encoding, encoding); + continue; + } + pf->offset[encoding-pf->firstchar] = ofs; + pf->width[encoding-pf->firstchar] = width; + + pf->bbx[encoding-pf->firstchar].w = bbw; + pf->bbx[encoding-pf->firstchar].h = bbh; + pf->bbx[encoding-pf->firstchar].x = bbx; + pf->bbx[encoding-pf->firstchar].y = bby; + + if (width > maxwidth) + maxwidth = width; + + /* clear bitmap*/ + memset(ch_bitmap, 0, BITMAP_BYTES(bbw) * bbh); + + ch_words = BITMAP_WORDS(bbw); + + /* read bitmaps*/ + for (i = 0; i < bbh; ++i) { + if (!bdf_getline(fp, buf, sizeof(buf))) { + fprintf(stderr, "Error: EOF reading BITMAP data\n"); + return 0; + } + if (isprefix(buf, "ENDCHAR")) + break; + + for (k = 0; k < ch_words; ++k) { + uInt16 value; + + value = bdf_hexval((unsigned char *)buf); + + if (bbw > 8) { + WRITE_UINT16(ch_bitmap, value); + } else { + WRITE_UINT16(ch_bitmap, value << 8); + } + ch_bitmap++; + } + } + + // If the default glyph is completely empty, the next + // glyph will not be dumped. Work around this by + // never generating completely empty glyphs. + + if (bbh == 0 && bbw == 0) { + pf->bbx[encoding-pf->firstchar].w = 1; + pf->bbx[encoding-pf->firstchar].h = 1; + *ch_bitmap++ = 0; + ofs++; + } else { + ofs += ch_words * bbh; + } + continue; + } + if (strequal(buf, "ENDFONT")) + break; + } + + /* set max width*/ + pf->maxwidth = maxwidth; + + /* change unused offset/width values to default char values*/ + for (i = 0; i < pf->size; ++i) { + int defchar = pf->defaultchar - pf->firstchar; + + if (pf->offset[i] == (unsigned long)-1) { + pf->offset[i] = pf->offset[defchar]; + pf->width[i] = pf->width[defchar]; + pf->bbx[i].w = pf->bbx[defchar].w; + pf->bbx[i].h = pf->bbx[defchar].h; + pf->bbx[i].x = pf->bbx[defchar].x; + pf->bbx[i].y = pf->bbx[defchar].y; + } + } + + /* determine whether font doesn't require encode table*/ + l = 0; + for (i = 0; i < pf->size; ++i) { + if (pf->offset[i] != l) { + encodetable = 1; + break; + } + l += BITMAP_WORDS(pf->bbx[i].w) * pf->bbx[i].h; + } + if (!encodetable) { + free(pf->offset); + pf->offset = NULL; + } + + /* determine whether font is fixed-width*/ + for (i = 0; i < pf->size; ++i) { + if (pf->width[i] != maxwidth) { + proportional = 1; + break; + } + } + if (!proportional) { + free(pf->width); + pf->width = NULL; + } + + /* determine if the font needs a bbx table */ + for (i = 0; i < pf->size; ++i) { + if (pf->bbx[i].w != pf->fbbw || pf->bbx[i].h != pf->fbbh || pf->bbx[i].x != pf->fbbx || pf->bbx[i].y != pf->fbby) { + need_bbx = 1; + break; + } + } + if (!need_bbx) { + free(pf->bbx); + pf->bbx = NULL; + } + + /* reallocate bits array to actual bits used*/ + if (ofs < pf->bits_size) { + pf->bits = realloc(pf->bits, ofs * sizeof(uInt16)); + pf->bits_size = ofs; + } + else { + if (ofs > pf->bits_size) { + fprintf(stderr, "Warning: DWIDTH spec > max FONTBOUNDINGBOX\n"); + if (ofs > pf->bits_size+EXTRA) { + fprintf(stderr, "Error: Not enough bits initially allocated\n"); + return 0; + } + pf->bits_size = ofs; + } + } + + return 1; +} + +/* read the next non-comment line, returns buf or NULL if EOF*/ +char *bdf_getline(FILE *fp, char *buf, int len) +{ + int c; + char *b; + + for (;;) { + b = buf; + while ((c = getc(fp)) != EOF) { + if (c == '\r') + continue; + if (c == '\n') + break; + if (b - buf >= (len - 1)) + break; + *b++ = c; + } + *b = '\0'; + if (c == EOF && b == buf) + return NULL; + if (b != buf && !isprefix(buf, "COMMENT")) + break; + } + return buf; +} + +/* return hex value of buffer */ +uInt16 bdf_hexval(unsigned char *buf) { + uInt16 val = 0; + unsigned char *ptr; + + for (ptr = buf; *ptr; ptr++) { + int c = *ptr; + + if (c >= '0' && c <= '9') + c -= '0'; + else if (c >= 'A' && c <= 'F') + c = c - 'A' + 10; + else if (c >= 'a' && c <= 'f') + c = c - 'a' + 10; + else + c = 0; + val = (val << 4) | c; + } + return val; +} + +/* generate C source from in-core font*/ +int gen_c_source(struct font* pf, char *path) +{ + FILE *ofp; + int h, i; + int did_defaultchar = 0; + int did_syncmsg = 0; + time_t t = time(0); + uInt16 *ofs = pf->bits; + char buf[256]; + char obuf[256]; + char bbuf[256]; + char hdr1[] = { + "//============================================================================\n" + "//\n" + "// SSSS tt lll lll\n" + "// SS SS tt ll ll\n" + "// SS tttttt eeee ll ll aaaa\n" + "// SSSS tt ee ee ll ll aa\n" + "// SS tt eeeeee ll ll aaaaa -- \"An Atari 2600 VCS Emulator\"\n" + "// SS SS tt ee ll ll aa aa\n" + "// SSSS ttt eeeee llll llll aaaaa\n" + "//\n" + "// Copyright (c) 1995-2013 by Bradford W. Mott, Stephen Anthony\n" + "// and the Stella Team\n" + "//\n" + "// See the file \"License.txt\" for information on usage and redistribution of\n" + "// this file, and for a DISCLAIMER OF ALL WARRANTIES.\n" + "//\n" + "// $Id$\n" + "//\n" + "// Generated by src/tools/convbdf on %s.\n" + "//============================================================================\n" + "\n" + "#ifndef %s_FONT_DATA_HXX\n" + "#define %s_FONT_DATA_HXX\n" + "\n" + "#include \"Font.hxx\"\n" + "\n" + "/* Font information:\n" + " name: %s\n" + " facename: %s\n" + " w x h: %dx%d\n" + " bbx: %d %d %d %d\n" + " size: %d\n" + " ascent: %d\n" + " descent: %d\n" + " first char: %d (0x%02x)\n" + " last char: %d (0x%02x)\n" + " default char: %d (0x%02x)\n" + " proportional: %s\n" + " %s\n" + "*/\n" + "\n" + "namespace GUI {\n" + "\n" + "// Font character bitmap data.\n" + "static const uInt16 %s_font_bits[] = {\n" + }; + + ofp = fopen(path, "w"); + if (!ofp) { + fprintf(stderr, "Can't create %s\n", path); + return 1; + } + + strcpy(buf, ctime(&t)); + buf[strlen(buf) - 1] = 0; + + fprintf(ofp, hdr1, buf, + fontnameU, fontnameU, + pf->name, + pf->facename? pf->facename: "", + pf->maxwidth, pf->height, + pf->fbbw, pf->fbbh, pf->fbbx, pf->fbby, + pf->size, + pf->ascent, pf->descent, + pf->firstchar, pf->firstchar, + pf->firstchar+pf->size-1, pf->firstchar+pf->size-1, + pf->defaultchar, pf->defaultchar, + pf->width? "yes": "no", + pf->copyright? pf->copyright: "", + fontname); + + /* generate bitmaps*/ + for (i = 0; i < pf->size; ++i) { + int x; + int bitcount = 0; + int width = pf->bbx ? pf->bbx[i].w : pf->fbbw; + int height = pf->bbx ? pf->bbx[i].h : pf->fbbh; + int xoff = pf->bbx ? pf->bbx[i].x : pf->fbbx; + int yoff = pf->bbx ? pf->bbx[i].y : pf->fbby; + uInt16 *bits = pf->bits + (pf->offset? pf->offset[i]: (height * i)); + uInt16 bitvalue = 0; + + /* + * Generate bitmap bits only if not this index isn't + * the default character in encode map, or the default + * character hasn't been generated yet. + */ + if (pf->offset && + (pf->offset[i] == pf->offset[pf->defaultchar-pf->firstchar])) { + if (did_defaultchar) + continue; + did_defaultchar = 1; + } + + fprintf(ofp, "\n/* Character %d (0x%02x):\n width %d\n bbx ( %d, %d, %d, %d )\n", + i+pf->firstchar, i+pf->firstchar, + pf->width ? pf->width[i+pf->firstchar] : pf->maxwidth, + width, height, xoff, yoff); + + if (gen_map) { + fprintf(ofp, "\n +"); + for (x=0; x 0) { + if (x == 0) fprintf(ofp, " |"); + + if (bitcount <= 0) { + bitcount = BITMAP_BITSPERIMAGE; + bitvalue = READ_UINT16(bits); + bits++; + } + + fprintf(ofp, BITMAP_TESTBIT(bitvalue)? "*": " "); + + bitvalue = BITMAP_SHIFTBIT(bitvalue); + --bitcount; + if (++x == width) { + fprintf(ofp, "|\n"); + --h; + x = 0; + bitcount = 0; + } + } + fprintf(ofp, " +"); + for (x = 0; x < width; ++x) + fprintf(ofp, "-"); + fprintf(ofp, "+\n*/\n"); + } else + fprintf(ofp, "\n*/\n"); + + bits = pf->bits + (pf->offset? pf->offset[i]: (height * i)); + for (x = BITMAP_WORDS(width) * height; x > 0; --x) { + fprintf(ofp, "0x%04x,\n", READ_UINT16(bits)); + if (!did_syncmsg && *bits++ != *ofs++) { + fprintf(stderr, "Warning: found encoding values in non-sorted order (not an error).\n"); + did_syncmsg = 1; + } + } + } + fprintf(ofp, "};\n\n"); + + if (pf->offset) { + /* output offset table*/ + fprintf(ofp, "/* Character->glyph mapping. */\n" + "static const uInt32 %s_sysfont_offset[] = {\n", fontname); + + for (i = 0; i < pf->size; ++i) + fprintf(ofp, " %ld,\t/* (0x%02x) */\n", + pf->offset[i], i+pf->firstchar); + fprintf(ofp, "};\n\n"); + } + + /* output width table for proportional fonts*/ + if (pf->width) { + fprintf(ofp, "/* Character width data. */\n" + "static const unsigned char %s_sysfont_width[] = {\n", fontname); + + for (i = 0; i < pf->size; ++i) + fprintf(ofp, " %d,\t/* (0x%02x) */\n", + pf->width[i], i+pf->firstchar); + fprintf(ofp, "};\n\n"); + } + + /* output bbox table */ + if (pf->bbx) { + fprintf(ofp, "/* Bounding box data. */\n" + "static const BBX %s_sysfont_bbx[] = {\n", fontname); + + for (i = 0; i < pf->size; ++i) + fprintf(ofp, "\t{ %d, %d, %d, %d },\t/* (0x%02x) */\n", + pf->bbx[i].w, pf->bbx[i].h, pf->bbx[i].x, pf->bbx[i].y, i+pf->firstchar); + fprintf(ofp, "};\n\n"); + } + + /* output struct font struct*/ + if (pf->offset) + sprintf(obuf, "%s_sysfont_offset,", fontname); + else + sprintf(obuf, "0, /* no encode table*/"); + + if (pf->width) + sprintf(buf, "%s_sysfont_width,", fontname); + else + sprintf(buf, "0, /* fixed width*/"); + + if (pf->bbx) + sprintf(bbuf, "%s_sysfont_bbx,", fontname); + else + sprintf(bbuf, "0, /* fixed bbox*/"); + + fprintf(ofp, + "/* Exported structure definition. */\n" + "static const FontDesc %sDesc = {\n" + " \"%s\",\n" + " %d,\n" + " %d,\n" + " %d, %d, %d, %d,\n" + " %d,\n" + " %d,\n" + " %d,\n" + " %s_font_bits,\n" + " %s\n" + " %s\n" + " %s\n" + " %d,\n" + " sizeof(%s_font_bits)/sizeof(uInt16)\n" + "};\n", + fontname, + pf->name, + pf->maxwidth, pf->height, + pf->fbbw, pf->fbbh, pf->fbbx, pf->fbby, + pf->ascent, + pf->firstchar, + pf->size, + fontname, + obuf, + buf, + bbuf, + pf->defaultchar, + fontname); + + fprintf(ofp, "\n} // End of namespace GUI\n\n#endif\n"); + + return 0; +}