Example #1
0
	void lime_cairo_set_font_size (value handle, double size) {
		
		cairo_font_face_t* face = cairo_get_font_face ((cairo_t*)val_data (handle));
		
		if (face) {
			
			cairo_font_type_t type = cairo_font_face_get_type (face);
			
			if (type == CAIRO_FONT_TYPE_FT) {
				
				AutoGCRoot* fontReference = (AutoGCRoot*)cairo_font_face_get_user_data (face, &userData);
				
				if (fontReference) {
					
					Font* font = (Font*)val_data (fontReference->get ());
					font->SetSize (size);
					
				}
				
			}
			
		}
		
		cairo_set_font_size ((cairo_t*)val_data (handle), size);
		
	}
Example #2
0
static cairo_test_status_t
draw (cairo_t *cr, int width, int height)
{
    cairo_font_face_t *font_face;
    cairo_font_options_t *font_options;
    cairo_scaled_font_t *scaled_font;
    cairo_matrix_t identity;
    cairo_matrix_t zero;

    cairo_matrix_init_identity(&identity);

    zero = identity;
    cairo_matrix_scale(&zero, 0, 0);

    font_face = cairo_get_font_face (cr);
    font_options = cairo_font_options_create ();
    cairo_get_font_options (cr, font_options);
    scaled_font = cairo_scaled_font_create (font_face,
	    &identity,
	    &zero,
	    font_options);
    cairo_set_scaled_font (cr, scaled_font);
    cairo_show_text (cr, "Hello");
    cairo_scaled_font_destroy (scaled_font);
    cairo_font_options_destroy (font_options);

    return cairo_test_status_from_status (cairo_test_get_context (cr),
                                          cairo_status(cr));
}
Example #3
0
 CairoFont(cairo_t *cr)
 {
 mFace = cairo_get_font_face(cr);
 mFamily = cairo_toy_font_face_get_family(mFace);
 mSlant = cairo_toy_font_face_get_slant(mFace);
 mWeight = cairo_toy_font_face_get_weight(mFace);
 }
Example #4
0
	value lime_cairo_get_font_face (value handle) {
		
		cairo_font_face_t* face = cairo_get_font_face ((cairo_t*)val_data (handle));
		cairo_font_face_reference (face);
		return CFFIPointer (face, gc_cairo_font_face);
		
	}
static PyObject *
pycairo_get_font_face (PycairoContext *o)
{
    cairo_font_face_t *font_face = cairo_get_font_face (o->ctx);
    cairo_font_face_reference (font_face);
    return PycairoFontFace_FromFontFace (font_face);
}
Example #6
0
static int
cr_get_font_face (lua_State *L) {
    cairo_t **obj = luaL_checkudata(L, 1, OOCAIRO_MT_NAME_CONTEXT);
    cairo_font_face_t **face = create_fontface_userdata(L);
    *face = cairo_get_font_face(*obj);
    cairo_font_face_reference(*face);
    return 1;
}
static VALUE
cr_get_font_face (VALUE self)
{
  cairo_font_face_t *face;

  face = cairo_get_font_face (_SELF);
  rb_cairo_check_status (cairo_font_face_status (face));
  return CRFONTFACE2RVAL (face);
}
void drawContextFltkCairo::drawString(const char *str)
{
  GLfloat pos[4], color[4];
  glGetFloatv(GL_CURRENT_RASTER_POSITION, pos);
  glGetFloatv(GL_CURRENT_COLOR, color);
  cairo_set_font_size(_cr, _currentFontSize);
  cairo_text_extents_t extent;
  cairo_text_extents(_cr, str, &extent);
  queueString::element elem = {str, pos[0], pos[1], pos[2], color[0], color[1], color[2], color[3],
    _currentFontSize, cairo_get_font_face(_cr), (int)ceil(extent.width) + 2, (int)ceil(extent.height) + 2,
    extent.x_bearing - 1, extent.y_bearing - 1};
  cairo_font_face_reference(elem.fontFace);
  _queue->append(elem);
}
Example #9
0
	double lime_cairo_get_font_face (double handle) {
		
		return (intptr_t)cairo_get_font_face ((cairo_t*)(intptr_t)handle);
		
	}
Example #10
0
FontFace* Context::getFontFace()
{
	return new FontFace( cairo_get_font_face( mCairo ) );
}
Example #11
0
static PyObject *
pycairo_get_font_face (PycairoContext *o) {
  return PycairoFontFace_FromFontFace (
       cairo_font_face_reference (cairo_get_font_face (o->ctx)));
}