void MCFontDrawText(MCGContextRef p_gcontext, int32_t x, int32_t y, const char *p_text, uint32_t p_length, MCFontRef p_font, bool p_is_unicode) { font_draw_text_context ctxt; ctxt.x = x; ctxt.y = y; ctxt.m_gcontext = p_gcontext; MCFontBreakText(p_font, p_text, p_length, p_is_unicode, (MCFontBreakTextCallback)MCFontDrawTextCallback, &ctxt); }
MCGFloat MCFontMeasureTextFloat(MCFontRef p_font, const char *p_text, uint32_t p_length, bool p_is_unicode) { font_measure_text_context ctxt; ctxt.m_width = 0; MCFontBreakText(p_font, p_text, p_length, p_is_unicode, (MCFontBreakTextCallback)MCFontMeasureTextCallback, &ctxt); return ctxt . m_width; }
MCGFloat MCFontMeasureTextSubstringFloat(MCFontRef p_font, MCStringRef p_string, MCRange p_range, const MCGAffineTransform &p_transform) { font_measure_text_context ctxt; ctxt.m_width = 0; ctxt.m_transform = p_transform; MCFontBreakText(p_font, p_string, p_range, (MCFontBreakTextCallback)MCFontMeasureTextCallback, &ctxt, false); return ctxt . m_width; }
void MCFontDrawTextSubstring(MCGContextRef p_gcontext, coord_t x, int32_t y, MCStringRef p_text, MCRange p_range, MCFontRef p_font, bool p_rtl, bool p_can_break) { font_draw_text_context ctxt; ctxt.x = x; ctxt.y = y; ctxt.m_gcontext = p_gcontext; ctxt.rtl = p_rtl; if (p_can_break) MCFontBreakText(p_font, p_text, p_range, (MCFontBreakTextCallback)MCFontDrawTextCallback, &ctxt, p_rtl); else { // AL-2014-08-20: [[ Bug 13186 ]] Ensure strings which skip go through the breaking algorithm // don't get permanently converted to UTF-16 when drawn MCAutoStringRef t_temp; /* UNCHECKED */ MCStringMutableCopy(p_text, &t_temp); MCFontDrawTextCallback(p_font, *t_temp, p_range, &ctxt); } }