Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 40 additions & 35 deletions src/lib/evas/canvas/evas_font_dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -723,40 +723,6 @@ evas_font_load(const Eina_List *font_paths, int hinting, Evas_Font_Description *
font = _evas_load_fontconfig(font, found_fd->set, size, wanted_rend, bitmap_scalable);
goto on_find;
}
#elif defined(_WIN32)
{
HFONT hfont = NULL, oldfont = NULL;
DWORD code;
DWORD buffer_size = 0;
void* buffer = NULL;
HDC dc = CreateCompatibleDC(NULL);

hfont = CreateFont (0, 1,
0, 0,
FW_DONTCARE,
0,0,
0, DEFAULT_CHARSET,
OUT_TT_ONLY_PRECIS/*OUT_OUTLINE_PRECIS*/, CLIP_DEFAULT_PRECIS,
DEFAULT_QUALITY, DEFAULT_PITCH, fdesc->name);
oldfont = SelectObject(dc, hfont);

code = GetFontData (dc, 0, 0, NULL, 0);
if (code != GDI_ERROR)
{
buffer_size = code;
buffer = calloc (buffer_size, 1);

code = GetFontData (dc, 0, 0, buffer, &buffer_size);
}

DeleteObject(hfont);
DeleteDC (dc);

fprintf(stderr, "Loading evas font %s %p\n", fdesc->name, buffer);
font = (Evas_Font_Set *)evas_common_font_memory_load(fdesc->name, fdesc->name, size, buffer, buffer_size, wanted_rend, EINA_FALSE);
free(buffer);
goto on_find;
}
#endif

EINA_LIST_FOREACH_SAFE(fonts_zero, l, l_next, fd)
Expand Down Expand Up @@ -1036,9 +1002,48 @@ evas_font_load(const Eina_List *font_paths, int hinting, Evas_Font_Description *
}
#endif
}
#elif defined(_WIN32)
if (!font)
{
HFONT hfont = NULL, oldfont = NULL;
DWORD code;
DWORD buffer_size = 0;
void* buffer = NULL;
HDC dc = CreateCompatibleDC(NULL);

if (dc)
{
hfont = CreateFont (0, 1,
0, 0,
FW_DONTCARE,
0,0,
0, DEFAULT_CHARSET,
OUT_TT_ONLY_PRECIS, CLIP_DEFAULT_PRECIS,
DEFAULT_QUALITY, DEFAULT_PITCH, fdesc->name);
if (hfont)
{
oldfont = SelectObject(dc, hfont);

code = GetFontData (dc, 0, 0, NULL, 0);
if (code != GDI_ERROR)
{
buffer_size = code;
buffer = calloc (buffer_size, 1);

code = GetFontData (dc, 0, 0, buffer, &buffer_size);
}

if (code != GDI_ERROR)
font = (Evas_Font_Set *)evas_common_font_memory_load(fdesc->name, fdesc->name, size, buffer, buffer_size, wanted_rend, EINA_FALSE);
free(buffer);
DeleteObject(hfont);
}
DeleteDC (dc);
}
}
#endif

#if defined(HAVE_FONTCONFIG) || defined(_WIN32)
#if defined(HAVE_FONTCONFIG)
on_find:
#endif
fd = calloc(1, sizeof(Fndat));
Expand Down