Some more experiments:

I made an array of bitmap_rgb32 and a readpngtobitmap routine and exposed them to lua:

	bitmap_rgb32 bitmaparray[10];
	bitmap_rgb32 * getbitmaparrayitem(int item) { return &(bitmaparray[item]); }
	void bitmapalloc(bitmap_rgb32& bitmap, int width, int height){ bitmap.allocate(width,height); }

int readpngtobitmap(bitmap_rgb32& bitmap, std::string filename){

         emu_file file("",OPEN_FLAG_READ);;
        osd_file::error const filerr =;
        if (filerr != osd_file::error::NONE)
                {printf("no file!\n"); return 0;}

        // read the PNG data
        png_info png;
        png_error const result = png.read_file(file);
        if (result != PNGERR_NONE)
                osd_printf_error("%s: Error reading PNG file\n", filename);
                return 0;
   bool hasalpha=false;
   png_error result2 = png.copy_to_bitmap( *((bitmap_argb32 * ) &bitmap), hasalpha);
      if (PNGERR_NONE != result2)
                        osd_printf_error("%s: Error copying PNG bitmap to MAME bitmap\n", filename);
                        osd_printf_error("Error result = %d\n", result);
                        return false;

printf("bitmap size %d %d\n",bitmap.width(),bitmap.height());
	return 1;

which allows me to load various bitmap fonts as pngs so I can use those fonts:

Opening ubuntu's character map on Noto Mono 22:
[Linked Image from]

Taking a screencap and figuring out the grid size in Gimp:
[Linked Image from]

and a test of what the font would look like (scaling the font to 66% to make it fit 80 columns wide):
[Linked Image from]


function drawstringscaleoffset(x,y,str,bitmap,xsize,ysize,rowsize,spacing,scale,offsetx,offsety,offsetsizex,offsetsizey,linegap,rtmar)
xpos = x ypos = y
  for i=1,str:len() do c = str:byte(i) if c>=32 and c<=127 then cpos = c - 32 colpos = cpos % rowsize rowpos = math.floor(cpos/rowsize) lp0:mycopyroz(lp0.m_lp_bitmap, bitmap, math.floor(colpos*xsize+offsetx),math.floor(rowpos*ysize+offsety) , xpos,ypos+792, offsetsizex, offsetsizey, scale, scale)
xpos = xpos + spacing end if xpos > rtmar or c==10 then xpos = x ypos=ypos+offsetsizey+linegap end

and an experiment with a spectrum zx 8x8 font (from DamienG's ZX Origins webpage):

(I couldn't figure out why the png wouldn't load and then I realized it was an 8-bit indexed png. After converting the file to rgb with gimp and exporting it worked fine.)

[Linked Image from]