From 95841d211e5501e745934e9935c0f4ff2880e2e9 Mon Sep 17 00:00:00 2001 From: Couriersud Date: Wed, 26 Feb 2014 20:59:23 +0000 Subject: [PATCH] Fixed loading of cached bdf fonts. --- src/emu/rendfont.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/emu/rendfont.c b/src/emu/rendfont.c index 91f75008f7e..217cff6276e 100644 --- a/src/emu/rendfont.c +++ b/src/emu/rendfont.c @@ -52,17 +52,15 @@ inline render_font::glyph &render_font::get_char(unicode_char chnum) static glyph dummy_glyph; // grab the table; if none, return the dummy character - glyph *glyphtable = m_glyphs[chnum / 256]; - if (glyphtable == NULL && m_format == FF_OSD) + if (m_glyphs[chnum / 256].count() == 0 && m_format == FF_OSD) { m_glyphs[chnum / 256].resize(256); - glyphtable = m_glyphs[chnum / 256]; } - if (glyphtable == NULL) + if (m_glyphs[chnum / 256].count() == 0) return dummy_glyph; // if the character isn't generated yet, do it now - glyph &gl = glyphtable[chnum % 256]; + glyph &gl = m_glyphs[chnum / 256][chnum % 256]; if (!gl.bitmap.valid()) char_expand(chnum, gl); @@ -403,7 +401,8 @@ bool render_font::load_cached_bdf(const char *filename) // if that worked, we're done if (result) { - m_rawdata.reset(); + // don't do that - glyphs data point into this array ... + // m_rawdata.reset(); return true; } } @@ -638,10 +637,9 @@ bool render_font::save_cached(const char *filename, UINT32 hash) int numchars = 0; for (int chnum = 0; chnum < 65536; chnum++) { - glyph *chtable = m_glyphs[chnum / 256]; - if (chtable != NULL) + if (m_glyphs[chnum / 256].count() > 0) { - glyph &gl = chtable[chnum % 256]; + glyph &gl = m_glyphs[chnum / 256][chnum % 256]; if (gl.width > 0) numchars++; }