- rface->need_update = 0;
- props = rface->face.property;
-
- rface->rfontset = mfont__realize_fontset (frame,
- (MFontset *) props[MFACE_FONTSET],
- &merged_face);
- g.c = ' ';
- num = 1;
- rfont = mfont__lookup_fontset (rface->rfontset, &g, &num,
- msymbol ("latin"), language, Mnil,
- size);
+ rface->font = font;
+
+ if (font)
+ {
+ if (font->type == MFONT_TYPE_SPEC)
+ rfont = (MRealizedFont *) mfont_find (frame, font, NULL, 0);
+ else if (font->type == MFONT_TYPE_OBJECT)
+ {
+ MFONT_INIT (&spec);
+ spec.size = (int) merged_face.property[MFONT_SIZE];
+ if (font->property[MFONT_REGISTRY])
+ spec.property[MFONT_REGISTRY] = font->property[MFONT_REGISTRY];
+ else
+ mfont_put_prop (&spec, Mregistry,
+ (font->source == MFONT_SOURCE_X
+ ? Miso8859_1 : Municode_bmp));
+ rfont = mfont__open (frame, font, &spec);
+ }
+ else
+ rfont = (MRealizedFont *) font;
+ }
+ else
+ {
+ MFontset *fontset = (MFontset *) merged_face.property[MFACE_FONTSET];
+
+ rface->rfontset = mfont__realize_fontset (frame, fontset, &merged_face,
+ font);
+ rfont = NULL;
+ mfont__set_spec_from_face (&spec, &merged_face);
+ mfont_put_prop (&spec, Mregistry, Municode_bmp);
+ spec.source = MFONT_SOURCE_FT;
+ font = mfont__select (frame, &spec, 0);
+ if (font)
+ rfont = mfont__open (frame, font, &spec);
+ if (! rfont)
+ {
+ mfont_put_prop (&spec, Mregistry, Miso8859_1);
+ spec.source = MFONT_SOURCE_X;
+ font = mfont__select (frame, &spec, 0);
+ if (font)
+ rfont = mfont__open (frame, font, &spec);
+ }
+ if (! rfont)
+ {
+ num = 0;
+ rfont = mfont__lookup_fontset (rface->rfontset, NULL, &num,
+ Mlatin, Mnil, Mnil, size, 0);
+ }
+ }