SetPort(GetWindowPort(s->window));
SetPort((GrafPtr)GetWindowPort(s->window));
static void mac_initfont(Session *s) {    FontInfo fi;    TextEncoding enc;    OptionBits fbflags;    SetPort(GetWindowPort(s->window));    GetFNum(s->cfg.font.name, &s->fontnum);    TextFont(s->fontnum);    TextFace(s->cfg.font.face);    TextSize(s->cfg.font.size);    GetFontInfo(&fi);    s->font_width = CharWidth('W'); /* Well, it's what NCSA uses. */    s->font_ascent = fi.ascent;    s->font_leading = fi.leading;    s->font_height = s->font_ascent + fi.descent + s->font_leading;    mac_workoutfontscale(s, s->font_width,			 &s->font_stdnumer, &s->font_stddenom);    mac_workoutfontscale(s, s->font_width * 2,			 &s->font_widenumer, &s->font_widedenom);    TextSize(s->cfg.font.size * 2);    mac_workoutfontscale(s, s->font_width * 2,			 &s->font_bignumer, &s->font_bigdenom);    TextSize(s->cfg.font.size);    if (!s->cfg.bold_colour) {	TextFace(bold);	s->font_boldadjust = s->font_width - CharWidth('W');    } else	s->font_boldadjust = 0;    if (s->uni_to_font != NULL)	DisposeUnicodeToTextInfo(&s->uni_to_font);    if (mac_gestalts.encvvers != 0 &&	UpgradeScriptInfoToTextEncoding(kTextScriptDontCare,					kTextLanguageDontCare,					kTextRegionDontCare, s->cfg.font.name,					&enc) == noErr &&	CreateUnicodeToTextInfoByEncoding(enc, &s->uni_to_font) == noErr) {	if (uni_to_font_fallback_upp == NULL)	    uni_to_font_fallback_upp =		NewUnicodeToTextFallbackUPP(&uni_to_font_fallback);	fbflags = kUnicodeFallbackCustomOnly;	if (mac_gestalts.uncvattr & kTECAddFallbackInterruptMask)	    fbflags |= kUnicodeFallbackInterruptSafeMask;	if (SetFallbackUnicodeToText(s->uni_to_font,	    uni_to_font_fallback_upp, fbflags, NULL) != noErr) {	    DisposeUnicodeToTextInfo(&s->uni_to_font);	    goto no_encv;	}    } else {	char cfontname[256];      no_encv:	s->uni_to_font = NULL;	p2cstrcpy(cfontname, s->cfg.font.name);	s->font_charset =	    charset_from_macenc(FontToScript(s->fontnum),				GetScriptManagerVariable(smRegionCode),				mac_gestalts.sysvers, cfontname);    }    mac_adjustsize(s, s->term->rows, s->term->cols);}