void GraphicsContext::drawLineForTextChecking(const FloatPoint& origin, float width, TextCheckingLineStyle style) { if (paintingDisabled()) return; cairo_t* cr = platformContext()->cr(); cairo_save(cr); switch (style) { case TextCheckingSpellingLineStyle: cairo_set_source_rgb(cr, 1, 0, 0); break; case TextCheckingGrammarLineStyle: cairo_set_source_rgb(cr, 0, 1, 0); break; default: cairo_restore(cr); return; } #if PLATFORM(GTK) // We ignore most of the provided constants in favour of the platform style pango_cairo_show_error_underline(cr, origin.x(), origin.y(), width, cMisspellingLineThickness); #else drawErrorUnderline(cr, origin.x(), origin.y(), width, cMisspellingLineThickness); #endif cairo_restore(cr); }
static VALUE rg_show_pango_error_underline(VALUE self, VALUE x, VALUE y, VALUE width, VALUE height) { pango_cairo_show_error_underline(RVAL2CRCONTEXT(self), NUM2DBL(x), NUM2DBL(y), NUM2DBL(width), NUM2DBL(height)); return self; }
void GraphicsContext::drawLineForMisspellingOrBadGrammar(const IntPoint& origin, int width, bool grammar) { if (paintingDisabled()) return; cairo_t* cr = m_data->cr; cairo_save(cr); // Convention is green for grammar, red for spelling // These need to become configurable if (grammar) cairo_set_source_rgb(cr, 0, 1, 0); else cairo_set_source_rgb(cr, 1, 0, 0); #if PLATFORM(GTK) // We ignore most of the provided constants in favour of the platform style pango_cairo_show_error_underline(cr, origin.x(), origin.y(), width, cMisspellingLineThickness); #else notImplemented(); #endif cairo_restore(cr); }