Previous 15994 Revisions Next

r9588 Tuesday 16th November, 2010 at 01:33:20 UTC by R. Belmont
SDL: Port over Ubuntu fixes from MAME [Barry Rodewald]
[src/osd/sdl]sdl.mak sdlmain.c

src/osd/sdl/sdl.mak
r9587r9588
345345LIBS += -lm -L$(SDL_INSTALL_ROOT)/lib -Wl,-rpath,$(SDL_INSTALL_ROOT)/lib -lSDL
346346endif
347347
348INCPATH += `pkg-config --cflags SDL_ttf fontconfig`
349LIBS += `pkg-config --libs SDL_ttf fontconfig`
348INCPATH += `pkg-config --cflags fontconfig`
349LIBS += `pkg-config --libs fontconfig`
350LIBS += -lSDL_ttf
350351
351352endif # Unix
352353
src/osd/sdl/sdlmain.c
r9587r9588
625625}
626626
627627#ifdef SDLMAME_UNIX
628#define POINT_SIZE 144.0
629
628630#ifdef SDLMAME_MACOSX
629631
630632#define EXTRA_HEIGHT 1.0
631633#define EXTRA_WIDTH 1.15
632#define POINT_SIZE 144.0
633634
634635//-------------------------------------------------
635636//  font_open - attempt to "open" a handle to the
r9587r9588
805806   bool bold = (name.replace(0, "[B]", "") + name.replace(0, "[b]", "") > 0);
806807   bool italic = (name.replace(0, "[I]", "") + name.replace(0, "[i]", "") > 0);
807808   bool underline = (name.replace(0, "[U]", "") + name.replace(0, "[u]", "") > 0);
809#if TTF_MAJOR_VERSION >= 2
810#if TTF_PATCHLEVEL >= 10  // SDL_ttf 2.0.9 and earlier does not define TTF_STYLE_STRIKETHROUGH
808811   bool strike = (name.replace(0, "[S]", "") + name.replace(0, "[s]", "") > 0);
812#endif // MAJOR_VERSION
813#endif // PATCHLEVEL
809814
810815   // first up, try it as a filename
811   font = TTF_OpenFont(name.cstr(), 120);
816   font = TTF_OpenFont(name.cstr(), POINT_SIZE);
812817
813818   // if that didn't work, crank up the FontConfig database
814819   if (!font)
r9587r9588
857862         }
858863
859864         mame_printf_verbose("Matching font: %s\n", val.u.s);
860         font = TTF_OpenFont((const char*)val.u.s, 120);
865         font = TTF_OpenFont((const char*)val.u.s, POINT_SIZE);
861866
862867         if (font)
863868         {
r9587r9588
891896            }
892897
893898            mame_printf_verbose("Matching unstyled font: %s\n", val.u.s);
894            font = TTF_OpenFont((const char*)val.u.s, 120);
899            font = TTF_OpenFont((const char*)val.u.s, POINT_SIZE);
895900
896901            if (font)
897902            {
r9587r9588
918923      style |= italic ? TTF_STYLE_ITALIC : 0;
919924   }
920925   style |= underline ? TTF_STYLE_UNDERLINE : 0;
926#if TTF_MAJOR_VERSION >= 2
927#if TTF_PATCHLEVEL >= 10
921928   style |= strike ? TTF_STYLE_STRIKETHROUGH : 0;
929#endif // MAJOR_VERSION
930#endif // PATCHLEVEL
922931   TTF_SetFontStyle(font, style);
923932
924933   height = TTF_FontLineSkip(font);
r9587r9588
954963   bitmap_t *bitmap = (bitmap_t *)NULL;
955964   SDL_Surface *drawsurf;
956965   SDL_Color fcol = { 0xff, 0xff, 0xff };
957   char ustr[16];
966   UINT16 ustr[16];
958967
959968   ttffont = (TTF_Font *)font;
960969   
961   memset(ustr, 0, sizeof(ustr));
962   utf8_from_uchar(ustr, 1, chnum);
963   drawsurf = TTF_RenderUTF8_Solid(ttffont, ustr, fcol);
970   memset(ustr,0,sizeof(ustr));
971   ustr[0] = (UINT16)chnum;
972   drawsurf = TTF_RenderUNICODE_Solid(ttffont, ustr, fcol);
964973
965974   // was nothing returned?
966975   if (drawsurf)

Previous 15994 Revisions Next


© 1998-2018 The MESS Team