- TextLength = StrLen(Text);
- if (TextLength * FONT_CELL_WIDTH + PosX > CompImage->Width)
- TextLength = (CompImage->Width - PosX) / FONT_CELL_WIDTH;
-
- // load the font
- if (FontImage == NULL)
- FontImage = egPrepareEmbeddedImage(&egemb_font, TRUE);
-
+ if (Text)
+ TextLength = StrLen(Text);
+ else
+ TextLength = 0;
+
+ if (TextLength * FontCellWidth + PosX > CompImage->Width)
+ TextLength = (CompImage->Width - PosX) / FontCellWidth;
+
+ if (BGBrightness < 128) {
+ if (LightFontImage == NULL) {
+ LightFontImage = egCopyImage(BaseFontImage);
+ if (LightFontImage == NULL)
+ return;
+ for (i = 0; i < (LightFontImage->Width * LightFontImage->Height); i++) {
+ LightFontImage->PixelData[i].r = 255 - LightFontImage->PixelData[i].r;
+ LightFontImage->PixelData[i].g = 255 - LightFontImage->PixelData[i].g;
+ LightFontImage->PixelData[i].b = 255 - LightFontImage->PixelData[i].b;
+ } // for
+ } // if
+ FontImage = LightFontImage;
+ } else {
+ if (DarkFontImage == NULL)
+ DarkFontImage = egCopyImage(BaseFontImage);
+ if (DarkFontImage == NULL)
+ return;
+ FontImage = DarkFontImage;
+ } // if/else
+