OSD Font Größe verändern

CHDK-Skripte, CHDK-Entwicklung, PC-Zusatzprogramme, Informationen für Tüftler

OSD Font Größe verändern

Beitragvon TaiJiGong » 22.05.2010, 22:20

Hallo Zusammen,

Ich versuche die OSD-Font Größe zu verändern, da ich bei meiner IXUS100is (sehr kleiner Monitor) fast nichts erkennen kann.

Mein Display hat eine Größe von (Breite) 50 mm x (Höhe) 38 mm. Das sind bei dem Standart Font mit 16 Pixeln (240 Pixel gesamt Display Höhe) eine Zeichenhöhe von etwa 2,5 mm. Dazu kommt das der Standart Font bei normalen Zeichen meistens oben 2 Pixelreihen + unten 3 Pixelreihen keine Daten enthält. Wird Teilweise gebraucht für "§$..,jgy". Also bleiben effektiv etwa 1,75 mm Fonthöhe übrig.

Bitte nicht verwechseln mit den MENU-Fonts wo das ja schon gut realisiert ist. Dafür habe ich schon größere Fonts erzeugt.
http://forum.chdk-treff.de/viewtopic.php?t=323

Mittlerweile habe ich auch schon mitbekommen das das nicht nur für mich ein Problem ist. Daher möchte ich versuchen eine Lösung für dieses Problem zu finden und realisieren.

Durch die vielfallt an größen der verbauten Displays, fände ich es schon gut wenn jeder Nutzer die Möglichkeit hätte einen für sich passende Font-Größe zu wählen.

Display Größe: 720 x 240
Koordinaten Ursprung: Oben/Links

Mein erster Versuch ist die Anzeigegröße zu verdoppeln, da das ohne allzuviel (s.u.) Nebeneffekte geht.

Dazu habe ich im souce folgende Änderungen vorgenommen (aus jedem Pixel werden 4 Pixel gemacht):

file: trunk-de/core/gui_draw.h

Code: Alles auswählen
#define FONT_WIDTH          16 // old value 8
#define FONT_HEIGHT         32 // old value 16


Code: Alles auswählen
void draw_char(coord x, coord y, const char ch, color cl) {
/*
    const unsigned char *sym = (unsigned char*)current_font +
            ((const unsigned char)ch)*FONT_HEIGHT;
Ersetzt durch:
*/
    const unsigned char *sym = (unsigned char*)current_font +
            ((const unsigned char)ch)*FONT_HEIGHT/2;

/*
    for (i=0; i<FONT_HEIGHT; i++){
        for (ii=0; ii<FONT_WIDTH; ii++){
            draw_pixel(x+ii ,y+i, (sym[i] & (0x80>>ii))? cl&0xff : cl>>8);
        }
    }
Ersetzt durch:
*/
    for (i=0; i<FONT_HEIGHT/2; i++)
    {
        for (ii=0; ii<FONT_WIDTH/2; ii++)
        {
            draw_pixel(x+2*ii   ,y+2*i,   (sym[i] & (0x80>>ii))? cl&0xff : cl>>8);
            draw_pixel(x+2*ii+1 ,y+2*i,   (sym[i] & (0x80>>ii))? cl&0xff : cl>>8);
            draw_pixel(x+2*ii   ,y+2*i+1, (sym[i] & (0x80>>ii))? cl&0xff : cl>>8);
            draw_pixel(x+2*ii+1 ,y+2*i+1, (sym[i] & (0x80>>ii))? cl&0xff : cl>>8);
        }
    }


void draw_txt_string(coord col, coord row, const char *str, color cl)
{
/*
    draw_string(col*FONT_WIDTH, row*FONT_HEIGHT, str, cl);
Ersetzt durch:
*/
    draw_string(col*FONT_WIDTH/2, row*FONT_HEIGHT/2, str, cl);
}


Damit habe ich erreicht das alle Zeichen doppelt so Hoch/Breit Dargestellt werden. Funktioniert auch so weit erst mal. Und endlich ist nun auch für mich was lesbar. Die Anzeige des "splash screen von CHDK" passt bestens.

Aber für Bestimmte Ausgaben ist wohl eine feste Position definiert die sich nicht nach den Font-Daten richtet. Das ist jetzt das nächste was ich herausfinden möchte.

Nebenefekte:
- <ALT> wird nicht mehr angezeigt
- Kamera nach einiger Zeit nicht mehr bedienbar
- Willkürlich wir das <ALTt> Menu beendet, bzw. nicht mehr angezeigt.
- Mitterweile habe ich die OSD Position von von vielen Anzeigen angepasst, seitdem läuft es stabieler.
- Lade Script-Datei geht nicht mehr

(Weis jemand wo man da die default Werte vergeben kann ? habe ich bereits gefunden)

file: trunk-de/core/gui_osd.c

Code: Alles auswählen
static OSD_elem osd[]={
    {LANG_OSD_LAYOUT_EDITOR_HISTO,      &conf.histo_pos,        {HISTO_WIDTH+2, HISTO_HEIGHT}   },
    {LANG_OSD_LAYOUT_EDITOR_DOF_CALC,   &conf.dof_pos,          {23*FONT_WIDTH, 2*FONT_HEIGHT}  },
    {LANG_OSD_LAYOUT_EDITOR_STATES,     &conf.mode_state_pos,   {12*FONT_WIDTH, 4*FONT_HEIGHT}   },
    {LANG_OSD_LAYOUT_EDITOR_RAW,     &conf.mode_raw_pos,   {7*FONT_WIDTH, FONT_HEIGHT}   },
    {LANG_OSD_LAYOUT_EDITOR_MISC,       &conf.values_pos,       {9*FONT_WIDTH, 9*FONT_HEIGHT}   },
    {LANG_OSD_LAYOUT_EDITOR_BAT_ICON,   &conf.batt_icon_pos,    {31, 12}                        },
    {LANG_OSD_LAYOUT_EDITOR_SPACE_ICON,   &conf.space_icon_pos,    {31, 19}                        },
    {LANG_OSD_LAYOUT_EDITOR_SPACE_ICON,   &conf.space_ver_pos,    {3, 50}                        },
    {LANG_OSD_LAYOUT_EDITOR_SPACE_ICON,   &conf.space_hor_pos,    {50, 3}                        },
    {LANG_OSD_LAYOUT_EDITOR_BAT_TEXT,   &conf.batt_txt_pos,     {5*FONT_WIDTH, FONT_HEIGHT}     },
    {LANG_OSD_LAYOUT_EDITOR_SPACE_TEXT,   &conf.space_txt_pos,     {5*FONT_WIDTH, FONT_HEIGHT}     },
    {LANG_OSD_LAYOUT_EDITOR_CLOCK,      &conf.clock_pos,        {5*FONT_WIDTH, FONT_HEIGHT}     },
    {LANG_OSD_LAYOUT_EDITOR_TEMP,      &conf.temp_pos,        {9*FONT_WIDTH, FONT_HEIGHT}     },
    {LANG_OSD_LAYOUT_EDITOR_VIDEO,     &conf.mode_video_pos,   {9*FONT_WIDTH, 4*FONT_HEIGHT}   },
    {LANG_OSD_LAYOUT_EDITOR_EV,     &conf.mode_ev_pos,   {12*FONT_WIDTH, FONT_HEIGHT}   },
#if CAM_EV_IN_VIDEO
    {LANG_OSD_LAYOUT_EDITOR_EV_VIDEO,         &conf.ev_video_pos,     {70,24}},
#endif
    {LANG_OSD_LAYOUT_EDITOR_USB_INFO,   &conf.usb_info_pos,    {31, 14}                        },
    {0}


Es ist zwar an vielen Stellen im code der Fall, das zwar (schon) die Font-Größe berücksichtigt wird, aber leider nicht die Display-Größe.

Mittlerweile arbeite ich mit einener Font-Größe von 30x16 Pixel, dann lassen sich noch 8 Zeilen auf dem Display darstellen

Für den splash-screen und die Memory- und Version-Infos werde ich das als nächstes anpassen. Dann werde ich die änderungen im Forum posten.

Meldet Euch bitte wenn Ihr dazu etwas wisst bzw. beitragen möchtet.

Ich würde mich freuen wenn sich noch Leute finden die dabei mitmachen möchten.

Viele Grüße, TaiJiGong
Canon IXUS 100 (SD780) Firmware: 1.00C, sonst nur rein mechanische Kameras wie Pentax-MX
TaiJiGong
CHDK-Begeisterter
CHDK-Begeisterter
 
Beiträge: 320
Registriert: 08.04.2010, 20:10
Wohnort: München
Kamera(s): IXUS100is, 100c
IXUS IIs (etwas defekt ohne CHDK)

Zurück zu Code-Ecke

Wer ist online?

Mitglieder in diesem Forum: 0 Mitglieder und 16 Gäste