Index: branches/ErmaC/Trunk/i386/libsaio/nvidia.c =================================================================== --- branches/ErmaC/Trunk/i386/libsaio/nvidia.c (revision 1716) +++ branches/ErmaC/Trunk/i386/libsaio/nvidia.c (revision 1717) @@ -830,7 +830,7 @@ // 1020 - 102F // 1030 - 103F // 1040 - 104F - { 0x10DE1040, "GeForce GT 520" }, + { 0x10DE1040, "GeForce GT 520" }, // 1050 - 105F { 0x10DE1050, "GeForce GT 520M" }, // 1060 - 106F Index: branches/ErmaC/Trunk/i386/libsaio/ati.c =================================================================== --- branches/ErmaC/Trunk/i386/libsaio/ati.c (revision 1716) +++ branches/ErmaC/Trunk/i386/libsaio/ati.c (revision 1717) @@ -506,7 +506,7 @@ { 0x68B8, 0x00CF106B, CHIP_FAMILY_JUNIPER, "ATI Radeon HD 5770", kHoolock }, - { 0x68B8, 0x145821f6, CHIP_FAMILY_JUNIPER, "GigaByte HD5770 R577SL-1GD", kVervet }, // ErmaC + { 0x68B8, 0x21f61458, CHIP_FAMILY_JUNIPER, "GigaByte HD5770 R577SL-1GD", kVervet }, // ErmaC { 0x68B8, 0x29901682, CHIP_FAMILY_JUNIPER, "ATI Radeon HD 5770", kVervet }, { 0x68B8, 0x29911682, CHIP_FAMILY_JUNIPER, "ATI Radeon HD 5770", kVervet }, @@ -527,6 +527,8 @@ { 0x68C0, 0x392717AA, CHIP_FAMILY_REDWOOD, "ATI Mobility Radeon HD 5730", kNull }, + { 0x68C0, 0x395217AA, CHIP_FAMILY_REDWOOD, "ATI Mobility Radeon HD 5730", kNull }, // ErmaC + { 0x68C1, 0x033E1025, CHIP_FAMILY_REDWOOD, "ATI Mobility Radeon HD 5650", kNull }, { 0x68C1, 0x9071104D, CHIP_FAMILY_REDWOOD, "ATI Mobility Radeon HD 5650", kEulemur }, @@ -560,8 +562,10 @@ { 0x68E1, 0x1426103C, CHIP_FAMILY_CEDAR, "ATI Radeon HD 5430M", kEulemur }, - { 0x68F9, 0x03741043, CHIP_FAMILY_CEDAR, "ASUS EAH5450", kNull }, // ErmaC + { 0x68F9, 0x010E1002, CHIP_FAMILY_CEDAR, "ATI Radeon HD 5450", kNull }, // ErmaC + { 0x68F9, 0x03741043, CHIP_FAMILY_CEDAR, "ASUS EAH5450", kNull }, // ErmaC + { 0x68F9, 0x5470174B, CHIP_FAMILY_CEDAR, "ATI Radeon HD 5470", kNull }, { 0x68F9, 0x5490174B, CHIP_FAMILY_CEDAR, "ATI Radeon HD 5490", kNull }, { 0x68F9, 0x5530174B, CHIP_FAMILY_CEDAR, "ATI Radeon HD 5530", kNull }, @@ -577,8 +581,8 @@ { 0x68F9, 0x301217AF, CHIP_FAMILY_CEDAR, "ATI Radeon HD 5490", kNull }, { 0x68F9, 0x301317AF, CHIP_FAMILY_CEDAR, "ATI Radeon HD 5470", kNull }, + { 0x68F9, 0xE145174B, CHIP_FAMILY_CEDAR, "ATI Radeon HD 5450", kEulemur }, // ErmaC { 0x68F9, 0xE153174B, CHIP_FAMILY_CEDAR, "ATI Radeon HD 5450", kEulemur }, // ErmaC - { 0x68F9, 0xE145174B, CHIP_FAMILY_CEDAR, "ATI Radeon HD 5450", kEulemur }, // ErmaC /* Northen Islands */ { 0x6718, 0x0B001002, CHIP_FAMILY_CAYMAN, "AMD Radeon HD 6970", kNull }, @@ -612,11 +616,12 @@ { 0x6738, 0x23051787, CHIP_FAMILY_BARTS, "AMD Radeon HD 6870", kDuckweed }, { 0x6739, 0x67391002, CHIP_FAMILY_BARTS, "AMD Radeon HD 6850", kDuckweed }, - { 0x6739, 0x21F81458, CHIP_FAMILY_BARTS, "AMD Radeon HD 6850", kDuckweed }, // ErmaC ?? kBulrushes ?? + { 0x6739, 0x21F81458, CHIP_FAMILY_BARTS, "AMD Radeon HD 6850", kDuckweed }, // ErmaC ?? kBulrushes ?? { 0x6739, 0x24411462, CHIP_FAMILY_BARTS, "AMD Radeon HD 6850", kDuckweed }, { 0x6739, 0x31101682, CHIP_FAMILY_BARTS, "AMD Radeon HD 6850", kDuckweed }, { 0x6739, 0xE177174B, CHIP_FAMILY_BARTS, "AMD Radeon HD 6850", kDuckweed }, + { 0x6740, 0x1D121043, CHIP_FAMILY_TURKS, "AMD Radeon HD 6730M", kNull }, // ErmaC { 0x6740, 0x1657103C, CHIP_FAMILY_TURKS, "AMD Radeon HD 6770M", kNull }, { 0x6740, 0x165A103C, CHIP_FAMILY_TURKS, "AMD Radeon HD 6770M", kNull }, Index: branches/ErmaC/Trunk/i386/boot2/gui.c =================================================================== --- branches/ErmaC/Trunk/i386/boot2/gui.c (revision 1716) +++ branches/ErmaC/Trunk/i386/boot2/gui.c (revision 1717) @@ -27,6 +27,8 @@ #define vram VIDEO(baseAddr) +#define TAB_PIXELS_WIDTH (font->chars[0]->width * 4) // tab = 4 spaces + int lasttime = 0; // we need this for animating maybe @@ -1312,34 +1314,49 @@ return 1; } +pixmap_t* charToPixmap(unsigned char ch, font_t *font) { + unsigned int cha = (unsigned int)ch - 32; + if (cha >= font->count) + // return ? if the font for the char doesn't exists + cha = '?' - 32; + + return font->chars[cha] ? font->chars[cha] : NULL; +} + +position_t drawChar(unsigned char ch, font_t *font, pixmap_t *blendInto, position_t p) { + pixmap_t* pm = charToPixmap(ch, font); + if (pm && ((p.x + pm->width) < blendInto->width)) + { + blend(pm, blendInto, p); + return pos(p.x + pm->width, p.y); + } + else + return p; +} + void drawStr(char *ch, font_t *font, pixmap_t *blendInto, position_t p) { int i=0; - int y=0; // we need this to support multilines '\n' - int x=0; + position_t current_pos = pos(p.x, p.y); - for(i=0;iheight; + current_pos.x = p.x; + current_pos.y += font->height; continue; } // tab ? - if( ch[i] == '\t' ) - x+=(font->chars[0]->width*5); + if ( ch[i] == '\t' ) + { + current_pos.x += TAB_PIXELS_WIDTH; + continue; + } - if(font->chars[cha] && ((x + font->chars[cha]->width) < blendInto->width)) - blend(font->chars[cha], blendInto, pos(p.x+x, p.y+y)); - - x += font->chars[cha]->width; + current_pos = drawChar(ch[i], font, blendInto, current_pos); } } @@ -1347,32 +1364,31 @@ { int i = 0; int width = 0; + int max_width = 0; // calculate the width in pixels - for(i=0;ichars[text[i]-32]->width; + for (i=0; i < strlen(text); i++) { + if (text[i] == '\n') + width = 0; + else if (text[i] == '\t') + width += TAB_PIXELS_WIDTH; + else + { + pixmap_t* pm = charToPixmap(text[i], font); + if (pm) + width += pm->width; + } + if (width > max_width) + max_width = width; + } - p.x = ( p.x - ( width / 2 ) ); + p.x = ( p.x - ( max_width / 2 ) ); p.y = ( p.y - ( font->height / 2 ) ); if ( p.x == -6 ) - { p.x = 0; - } - for(i=0;ichars[cha]) - { - blend(font->chars[cha], blendInto, p); - p.x += font->chars[cha]->width; - } - } - + drawStr(text, font, blendInto, p); } int initFont(font_t *font, image_t *data) @@ -1383,9 +1399,9 @@ bool monospaced = false; - font->height = data->image->height; + font->height = data->image->height; - for( x = 0; x < data->image->width; x++) + for( x = 0; x < data->image->width && count < CHARACTERS_COUNT; x++) { start = end; @@ -1423,9 +1439,14 @@ } } + for (x = count; x < CHARACTERS_COUNT; x++) + font->chars[x] = NULL; + if(monospaced) font->width = 0; + font->count = count; + return 0; } Index: branches/ErmaC/Trunk/i386/boot2/gui.h =================================================================== --- branches/ErmaC/Trunk/i386/boot2/gui.h (revision 1716) +++ branches/ErmaC/Trunk/i386/boot2/gui.h (revision 1717) @@ -64,6 +64,7 @@ uint16_t height; // Font Height uint16_t width; // Font Width for monospace font only pixmap_t *chars[CHARACTERS_COUNT]; + uint16_t count; // Number of chars in font } font_t; /* Index: branches/ErmaC/Trunk/package/Resources/ko.lproj/Localizable.strings =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: branches/ErmaC/Modules/i386/boot2/gui.c =================================================================== --- branches/ErmaC/Modules/i386/boot2/gui.c (revision 1716) +++ branches/ErmaC/Modules/i386/boot2/gui.c (revision 1717) @@ -27,6 +27,8 @@ #define vram VIDEO(baseAddr) +#define TAB_PIXELS_WIDTH (font->chars[0]->width * 4) // tab = 4 spaces + int lasttime = 0; // we need this for animating maybe @@ -1312,34 +1314,49 @@ return 1; } +pixmap_t* charToPixmap(unsigned char ch, font_t *font) { + unsigned int cha = (unsigned int)ch - 32; + if (cha >= font->count) + // return ? if the font for the char doesn't exists + cha = '?' - 32; + + return font->chars[cha] ? font->chars[cha] : NULL; +} + +position_t drawChar(unsigned char ch, font_t *font, pixmap_t *blendInto, position_t p) { + pixmap_t* pm = charToPixmap(ch, font); + if (pm && ((p.x + pm->width) < blendInto->width)) + { + blend(pm, blendInto, p); + return pos(p.x + pm->width, p.y); + } + else + return p; +} + void drawStr(char *ch, font_t *font, pixmap_t *blendInto, position_t p) { int i=0; - int y=0; // we need this to support multilines '\n' - int x=0; + position_t current_pos = pos(p.x, p.y); - for(i=0;iheight; + current_pos.x = p.x; + current_pos.y += font->height; continue; } // tab ? - if( ch[i] == '\t' ) - x+=(font->chars[0]->width*5); + if ( ch[i] == '\t' ) + { + current_pos.x += TAB_PIXELS_WIDTH; + continue; + } - if(font->chars[cha] && ((x + font->chars[cha]->width) < blendInto->width)) - blend(font->chars[cha], blendInto, pos(p.x+x, p.y+y)); - - x += font->chars[cha]->width; + current_pos = drawChar(ch[i], font, blendInto, current_pos); } } @@ -1347,32 +1364,31 @@ { int i = 0; int width = 0; + int max_width = 0; // calculate the width in pixels - for(i=0;ichars[text[i]-32]->width; + for (i=0; i < strlen(text); i++) { + if (text[i] == '\n') + width = 0; + else if (text[i] == '\t') + width += TAB_PIXELS_WIDTH; + else + { + pixmap_t* pm = charToPixmap(text[i], font); + if (pm) + width += pm->width; + } + if (width > max_width) + max_width = width; + } - p.x = ( p.x - ( width / 2 ) ); + p.x = ( p.x - ( max_width / 2 ) ); p.y = ( p.y - ( font->height / 2 ) ); if ( p.x == -6 ) - { p.x = 0; - } - for(i=0;ichars[cha]) - { - blend(font->chars[cha], blendInto, p); - p.x += font->chars[cha]->width; - } - } - + drawStr(text, font, blendInto, p); } int initFont(font_t *font, image_t *data) @@ -1383,9 +1399,9 @@ bool monospaced = false; - font->height = data->image->height; + font->height = data->image->height; - for( x = 0; x < data->image->width; x++) + for( x = 0; x < data->image->width && count < CHARACTERS_COUNT; x++) { start = end; @@ -1423,9 +1439,14 @@ } } + for (x = count; x < CHARACTERS_COUNT; x++) + font->chars[x] = NULL; + if(monospaced) font->width = 0; + font->count = count; + return 0; } Index: branches/ErmaC/Modules/i386/boot2/gui.h =================================================================== --- branches/ErmaC/Modules/i386/boot2/gui.h (revision 1716) +++ branches/ErmaC/Modules/i386/boot2/gui.h (revision 1717) @@ -64,6 +64,7 @@ uint16_t height; // Font Height uint16_t width; // Font Width for monospace font only pixmap_t *chars[CHARACTERS_COUNT]; + uint16_t count; // Number of chars in font } font_t; /* Index: branches/ErmaC/Modules/package/Resources/ko.lproj/Localizable.strings =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream