rem: font = sub; cfont = font->BuildInternalFont(dc, screen_font, angle);
add: int max_alen;   max_alen = alen; for (i = 1; i < alen; i++) { v = ustring[d+i]; if (font->GlyphAvailableNow(v, dc, screen_font)) { max_alen = i; break; } }  cfont = sub->BuildInternalFont(dc, screen_font, angle);
context: static int substitute_font(wchar_t *ustring, int d, int alen, wxFont *font, HDC dc, Bool screen_font, double angle, int *reset){  int v, i;  if (*reset) {    HFONT cfont;    *reset = 0;    cfont = font->BuildInternalFont(dc, screen_font, angle);    if (cfont) {      ::SelectObject(dc, cfont);    }  }  v = ustring[d];  if (!font->GlyphAvailableNow(v, dc, screen_font)) {    wxFont *sub;    sub = font->Substitute(v, dc, screen_font);    if (sub) {      HFONT cfont;      font = sub;      cfont = font->BuildInternalFont(dc, screen_font, angle);      if (cfont) {	::SelectObject(dc, cfont);      }    }  }  for (i = 1; i < alen; i++) {    v = ustring[d+i];    if (!font->GlyphAvailableNow(v, dc, screen_font)) {      return i;    }  }  return alen;}