• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ cairo_select_font_face函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中cairo_select_font_face函数的典型用法代码示例。如果您正苦于以下问题:C++ cairo_select_font_face函数的具体用法?C++ cairo_select_font_face怎么用?C++ cairo_select_font_face使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了cairo_select_font_face函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: gtk_clock_draw

static gboolean gtk_clock_draw (GtkWidget *widget, cairo_t *ctx)
{

    struct tm *tms;
    time_t t;
	GtkClockPrivate *priv = GTK_CLOCK(widget)->priv;

    g_free(priv->time);
    t = time (NULL);
    tms = localtime(&t);
    priv->time = 
        g_strdup_printf ("%.2d%c%.2d", tms->tm_hour, priv->secflash ? ':' : ' ', tms->tm_min);
    priv->date = 
        g_strdup_printf ("%s %s , %s", month[tms->tm_mon], day[tms->tm_mday], weekday[tms->tm_wday]);

    cairo_set_source_rgba (ctx, 0.0, 0.0, 0.0, 0.6);
    cairo_paint (ctx);

    cairo_move_to (ctx, 20, 50);
    cairo_select_font_face (ctx, "Sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
    cairo_set_font_size (ctx, 45);
    cairo_set_source_rgb (ctx, 1.0, 1.0, 1.0);
    cairo_show_text (ctx, priv->time);

    cairo_select_font_face (ctx, "Sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
    cairo_set_font_size (ctx, 24);
    cairo_move_to (ctx, 20, 84);
    cairo_show_text (ctx, priv->date);

	return FALSE;
}
开发者ID:hualet,项目名称:lightdm-startos-greeter,代码行数:31,代码来源:gtkclock.c


示例2: redraw_handler

static void
redraw_handler(struct widget *widget, void *data)
{
	struct cliptest *cliptest = data;
	struct geometry *g = cliptest->view.geometry;
	struct rectangle allocation;
	cairo_t *cr;
	cairo_surface_t *surface;
	GLfloat ex[8];
	GLfloat ey[8];
	int n;

	n = calculate_edges(&cliptest->view, &g->clip, &g->surf, ex, ey);

	widget_get_allocation(cliptest->widget, &allocation);

	surface = window_get_surface(cliptest->window);
	cr = cairo_create(surface);
	widget_get_allocation(cliptest->widget, &allocation);
	cairo_rectangle(cr, allocation.x, allocation.y,
			allocation.width, allocation.height);
	cairo_clip(cr);

	cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
	cairo_set_source_rgba(cr, 0, 0, 0, 1);
	cairo_paint(cr);

	cairo_translate(cr, allocation.x, allocation.y);
	cairo_set_line_width(cr, 1.0);
	cairo_move_to(cr, allocation.width / 2.0, 0.0);
	cairo_line_to(cr, allocation.width / 2.0, allocation.height);
	cairo_move_to(cr, 0.0, allocation.height / 2.0);
	cairo_line_to(cr, allocation.width, allocation.height / 2.0);
	cairo_set_source_rgba(cr, 0.5, 0.5, 0.5, 1.0);
	cairo_stroke(cr);

	cairo_set_operator(cr, CAIRO_OPERATOR_OVER);
	cairo_push_group(cr);
		cairo_translate(cr, allocation.width / 2.0,
				allocation.height / 2.0);
		cairo_scale(cr, 4.0, 4.0);
		cairo_set_line_width(cr, 0.5);
		cairo_set_line_join(cr, CAIRO_LINE_JOIN_BEVEL);
		cairo_select_font_face(cr, "Sans", CAIRO_FONT_SLANT_NORMAL,
				       CAIRO_FONT_WEIGHT_BOLD);
		cairo_set_font_size(cr, 5.0);
		draw_geometry(cr, &cliptest->view, ex, ey, n);
	cairo_pop_group_to_source(cr);
	cairo_paint(cr);

	cairo_set_source_rgba(cr, 0.0, 1.0, 0.0, 1.0);
	cairo_select_font_face(cr, "monospace", CAIRO_FONT_SLANT_NORMAL,
			       CAIRO_FONT_WEIGHT_NORMAL);
	cairo_set_font_size(cr, 12.0);
	draw_coordinates(cr, 10.0, 10.0, ex, ey, n);

	cairo_destroy(cr);

	cairo_surface_destroy(surface);
}
开发者ID:ChristophHaag,项目名称:weston,代码行数:60,代码来源:cliptest.c


示例3: draw

static cairo_test_status_t
draw (cairo_t *cr, int width, int height)
{
    /* We draw in the default black, so paint white first. */
    cairo_save (cr);
    cairo_set_source_rgb (cr, 1.0, 1.0, 1.0); /* white */
    cairo_paint (cr);
    cairo_restore (cr);

    cairo_set_source_rgb (cr, 0, 0, 0); /* black */

    cairo_select_font_face (cr, "Bitstream Vera Serif",
			    CAIRO_FONT_SLANT_NORMAL,
			    CAIRO_FONT_WEIGHT_NORMAL);
    cairo_set_font_size (cr, TEXT_SIZE);

    cairo_move_to (cr, 0, TEXT_SIZE);
    cairo_show_text (cr, "i-am-serif");

    cairo_select_font_face (cr, "Bitstream Vera Sans",
			    CAIRO_FONT_SLANT_NORMAL,
			    CAIRO_FONT_WEIGHT_NORMAL);
    cairo_show_text (cr, " i-am-sans");

    cairo_select_font_face (cr, "Bitstream Vera Sans Mono",
			    CAIRO_FONT_SLANT_NORMAL,
			    CAIRO_FONT_WEIGHT_NORMAL);
    cairo_show_text (cr, " i-am-mono");

    return CAIRO_TEST_SUCCESS;
}
开发者ID:Dirbaio,项目名称:libgdiplus,代码行数:31,代码来源:select-font-face.c


示例4: main

/*
    To test, copy the the following files to the disk image:
        vcopy /dev/sdb ../../es-trunk/cmd/fonts.conf
        vcopy /dev/sdb ../../es-trunk/cmd/fonts.dtd
        vcopy /dev/sdb ../../es-trunk/cmd/40-generic.conf conf.d/
        vcopy /dev/sdb /usr/share/fonts/liberation/LiberationMono-Regular.ttf fonts/
        vcopy /dev/sdb /usr/share/fonts/liberation/LiberationSans-Regular.ttf fonts/
        vcopy /dev/sdb /usr/share/fonts/liberation/LiberationSerif-Regular.ttf fonts/

 */
int main(int argc, char* argv[])
{
    init();

    cairo_surface_t *surface;
    cairo_t *cr;

    surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 320, 320);
    cr = cairo_create (surface);

    cairo_translate (cr, 10, 10);
    cairo_scale (cr, 100, 100);

    cairo_rectangle (cr, 0.0, 0.0, 3.0, 3.0);
    cairo_set_source_rgb (cr, 1.0, 1.0, 1.0);
    cairo_fill (cr);

    cairo_text_extents_t te;

    cairo_set_source_rgb (cr, 1.0, 0.0, 0.0);
    cairo_select_font_face (cr, "Liberation Serif", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
    cairo_set_font_size (cr, 1.0);
    cairo_text_extents (cr, "Hello", &te);
    cairo_move_to (cr, 1.5 - te.width / 2 - te.x_bearing, 0.5 - te.height / 2 - te.y_bearing);
    cairo_show_text (cr, "Hello");

    cairo_set_source_rgb (cr, 0.0, 1.0, 0.0);
    cairo_select_font_face (cr, "Liberation Sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
    cairo_set_font_size (cr, 1.0);
    cairo_text_extents (cr, "Hello", &te);
    cairo_move_to (cr, 1.5 - te.width / 2 - te.x_bearing, 1.5 - te.height / 2 - te.y_bearing);
    cairo_show_text (cr, "Hello");

    cairo_set_source_rgb (cr, 0.0, 0.0, 1.0);
    cairo_select_font_face (cr, "Liberation Mono", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
    cairo_set_font_size (cr, 1.0);
    cairo_text_extents (cr, "Hello", &te);
    cairo_move_to (cr, 1.5 - te.width / 2 - te.x_bearing, 2.5 - te.height / 2 - te.y_bearing);
    cairo_show_text (cr, "Hello");

    esReport("--- cairo_image_surface_get_data ---\n");
    u8* data = cairo_image_surface_get_data (surface);
    for (int y = 0; y < 320; ++y)
    {
        memmove(framebufferPtr + 4 * WIDTH * y,
                data + 4 * 320 * y,
                4 * 320);
    }
}
开发者ID:giobeatle1794,项目名称:es-operating-system,代码行数:59,代码来源:fontconfig.cpp


示例5: draw

static cairo_test_status_t
draw (cairo_t *cr, int width, int height)
{
    cairo_set_source_rgb (cr, 0, 0, 1);
    cairo_paint (cr);

    cairo_reset_clip (cr);
    cairo_clip (cr);

    cairo_translate (cr, .5, .5);

    cairo_set_source_rgb (cr, 0, 1, 0);
    cairo_rectangle (cr, 0, 0, SIZE, SIZE);
    cairo_fill_preserve (cr);
    cairo_set_source_rgb (cr, 1, 0, 0);
    cairo_stroke (cr);

    /* https://bugs.freedesktop.org/show_bug.cgi?id=13084 */
    cairo_select_font_face (cr,
	                    "Bitstream Vera Sans",
			    CAIRO_FONT_SLANT_NORMAL,
			    CAIRO_FONT_WEIGHT_NORMAL);

    cairo_move_to (cr, 0., SIZE);
    cairo_show_text (cr, "cairo");

    return CAIRO_TEST_SUCCESS;
}
开发者ID:AliYousuf,项目名称:cairo,代码行数:28,代码来源:clip-empty.c


示例6: selectFontFace_func

static JSBool
selectFontFace_func(JSContext *context,
                    unsigned   argc,
                    jsval     *vp)
{
    JS::CallArgs argv = JS::CallArgsFromVp (argc, vp);
    JSObject *obj = JSVAL_TO_OBJECT(argv.thisv());

    char *family;
    cairo_font_slant_t slant;
    cairo_font_weight_t weight;
    cairo_t *cr;

    if (!gjs_parse_call_args(context, "selectFontFace", "sii", argv,
                        "family", &family,
                        "slang", &slant,
                        "weight", &weight))
        return JS_FALSE;

    cr = gjs_cairo_context_get_context(context, obj);

    cairo_select_font_face(cr, family, slant, weight);
    g_free(family);

    if (!gjs_cairo_check_status(context, cairo_status(cr), "context"))
        return JS_FALSE;
    argv.rval().set(JSVAL_VOID);

    return JS_TRUE;
}
开发者ID:dreamsxin,项目名称:gjs,代码行数:30,代码来源:cairo-context.cpp


示例7: paint_message

void paint_message(cairo_t *cr, const char *from, const char *content)
{
  static char from_buffer[256];
  if (strlen(from) > 0)
    snprintf(from_buffer, sizeof(from_buffer), "[%s]", from);
  else
    strncpy(from_buffer, "", sizeof(from_buffer));
  cairo_save(cr);
  
  //清空背景
  cairo_set_source_rgba (cr, 1.0, 1.0, 1.0, 0.0);
  cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
  cairo_paint (cr);

  //设置字体
  cairo_select_font_face (cr, font_name, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
  cairo_set_font_size (cr, font_size);

  //计算文字位置
  cairo_text_extents_t extents_from, extents_content;
  cairo_text_extents(cr, from_buffer, &extents_from);
  cairo_text_extents(cr, content, &extents_content);
  int x = (window_width - extents_from.width - extents_content.width) / 2;
  if (x < 0)
    x = 0;
  int y = window_height - 10;

  //实现昵称和消息内容
  paint_text(cr, from_buffer, x, y, 1, 2, font_color, border_color, shadow_color);
  paint_text(cr, content, x + extents_from.width + font_size / 2, y, 1, 2, font_color, border_color, shadow_color);

  cairo_restore (cr);
  check_cairo_status();
}
开发者ID:zzmfish,项目名称:osdchat,代码行数:34,代码来源:osd_window.c


示例8: cairo_save

void GraphicsLayerTextureMapper::drawRepaintCounter(GraphicsContext* context)
{
    cairo_t* cr = context->platformContext()->cr();
    cairo_save(cr);

    CString repaintCount = String::format("%i", this->repaintCount()).utf8();
    cairo_select_font_face(cr, "sans-serif", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
    cairo_set_font_size(cr, 18);

    cairo_text_extents_t repaintTextExtents;
    cairo_text_extents(cr, repaintCount.data(), &repaintTextExtents);

    static const int repaintCountBorderWidth = 10;
    setSourceRGBAFromColor(cr, isShowingDebugBorder() ? m_debugBorderColor : Color(0, 255, 0, 127));
    cairo_rectangle(cr, 0, 0,
        repaintTextExtents.width + (repaintCountBorderWidth * 2),
        repaintTextExtents.height + (repaintCountBorderWidth * 2));
    cairo_fill(cr);

    cairo_set_source_rgb(cr, 1, 1, 1);
    cairo_move_to(cr, repaintCountBorderWidth, repaintTextExtents.height + repaintCountBorderWidth);
    cairo_show_text(cr, repaintCount.data());

    cairo_restore(cr);
}
开发者ID:jiezh,项目名称:h5vcc,代码行数:25,代码来源:GraphicsLayerTextureMapper.cpp


示例9: cairo_select_font_face

// -------------------------------------------------------------------
// - Font services -
// -------------------------------------------------------------------
void CairoDevice::SelectFont( const VGFont * font )
{
	cairo_font_slant_t slant = font->GetProperties() & VGFont::kFontItalic ? CAIRO_FONT_SLANT_ITALIC : CAIRO_FONT_SLANT_NORMAL;
	cairo_font_weight_t weight = font->GetProperties() & VGFont::kFontBold ? CAIRO_FONT_WEIGHT_BOLD : CAIRO_FONT_WEIGHT_NORMAL;
	cairo_select_font_face (fNativeDevice, font->GetName(), slant, weight);
	cairo_set_font_size (fNativeDevice, font->GetSize());
}
开发者ID:anttirt,项目名称:guidolib,代码行数:10,代码来源:CairoDevice.cpp


示例10: _draw_chip_vectorized

static void
_draw_chip_vectorized(drawing_context_t *ctx,
		      const chip_descr_t *chip) {
  cairo_t *cr = ctx->cr;

  debit_log(L_DRAW, "vectorized chip draw");
  cairo_rectangle(cr, 0., 0.,
		  chip->width * SITE_WIDTH,
		  chip->height * SITE_HEIGHT);
  cairo_clip (cr);

  /* paint the clip region */
  cairo_set_source_rgb (cr, 0., 0., 0.);
  cairo_paint (cr);

  /* draw everything in white. This could be per-site or per-site-type */
  cairo_set_source_rgb (cr, 1.0, 1.0, 1.0);
  cairo_set_line_width (cr, 1);

  cairo_select_font_face(cr, NAME_FONT_TYPE,
			 CAIRO_FONT_SLANT_NORMAL,
			 CAIRO_FONT_WEIGHT_NORMAL);
  cairo_set_font_size(cr, NAME_FONT_SIZE);

  iterate_over_sites(chip, draw_site_vector, ctx);
}
开发者ID:Martoni,项目名称:debit,代码行数:26,代码来源:sites_draw.c


示例11: text_entry_draw

static void
text_entry_draw(struct text_entry *entry, cairo_t *cr)
{
	cairo_save(cr);
	cairo_set_operator(cr, CAIRO_OPERATOR_OVER);

	cairo_rectangle(cr, entry->allocation.x, entry->allocation.y, entry->allocation.width, entry->allocation.height);
	cairo_clip(cr);

	cairo_translate(cr, entry->allocation.x, entry->allocation.y);
	cairo_rectangle(cr, 0, 0, entry->allocation.width, entry->allocation.height);
	cairo_set_source_rgba(cr, 1, 1, 1, 0.5);
	cairo_fill(cr);
	if (entry->active) {
		cairo_rectangle(cr, 0, 0, entry->allocation.width, entry->allocation.height);
		cairo_set_source_rgba(cr, 0, 0, 1, 0.5);
		cairo_stroke(cr);
	}

	cairo_set_source_rgb(cr, 0, 0, 0);
	cairo_select_font_face(cr, "sans",
			       CAIRO_FONT_SLANT_NORMAL,
			       CAIRO_FONT_WEIGHT_BOLD);
	cairo_set_font_size(cr, 14);

	cairo_translate(cr, 10, entry->allocation.height / 2);
	cairo_show_text(cr, entry->text);

	cairo_restore(cr);
}
开发者ID:Blei,项目名称:weston,代码行数:30,代码来源:editor.c


示例12: set_font

static void
set_font(DiaRenderer *self, DiaFont *font, real height)
{
  DiaCairoRenderer *renderer = DIA_CAIRO_RENDERER (self);
  /* pango/cairo wants the font size, not the (line-) height */
  real size = dia_font_get_size (font) * (height / dia_font_get_height (font));

  PangoFontDescription *pfd = pango_font_description_copy (dia_font_get_description (font));
  DIAG_NOTE(g_message("set_font %f %s", height, dia_font_get_family(font)));

#ifdef HAVE_PANGOCAIRO_H
  /* select font and size */
  pango_font_description_set_absolute_size (pfd, (int)(size * PANGO_SCALE));
  pango_layout_set_font_description (renderer->layout, pfd);
  pango_font_description_free (pfd);
#else
  if (renderer->cr) {
    DiaFontStyle style = dia_font_get_style (font);
    const char *family_name = dia_font_get_family(font);

    cairo_select_font_face (
        renderer->cr,
        family_name,
        DIA_FONT_STYLE_GET_SLANT(style) == DIA_FONT_NORMAL ? CAIRO_FONT_SLANT_NORMAL : CAIRO_FONT_SLANT_ITALIC,
        DIA_FONT_STYLE_GET_WEIGHT(style) < DIA_FONT_MEDIUM ? CAIRO_FONT_WEIGHT_NORMAL : CAIRO_FONT_WEIGHT_BOLD); 
    cairo_set_font_size (renderer->cr, size);

    DIAG_STATE(renderer->cr)
  }
开发者ID:trilomix,项目名称:dia,代码行数:29,代码来源:diacairo-renderer.c


示例13: draw

static cairo_test_status_t
draw (cairo_t *cr, int width, int height)
{
    const cairo_test_context_t *ctx = cairo_test_get_context (cr);
    cairo_pattern_t *pattern;

    cairo_set_source_rgb (cr, 1., 1., 1.);
    cairo_paint (cr);

    cairo_set_source_rgb (cr, 0., 0., 0.);

    cairo_select_font_face (cr, CAIRO_TEST_FONT_FAMILY " Sans",
			    CAIRO_FONT_SLANT_NORMAL,
			    CAIRO_FONT_WEIGHT_NORMAL);

    draw_text (cr);

    cairo_translate (cr, SIZE, SIZE);
    cairo_rotate (cr, M_PI);

    pattern = cairo_test_create_pattern_from_png (ctx, png_filename);
    cairo_pattern_set_extend (pattern, CAIRO_EXTEND_REPEAT);
    cairo_set_source (cr, pattern);
    cairo_pattern_destroy (pattern);

    draw_text (cr);

    return CAIRO_TEST_SUCCESS;
}
开发者ID:499940913,项目名称:moon,代码行数:29,代码来源:text-transform.c


示例14: main

int main (int argc, char *argv[])
{
  cairo_surface_t *surface;
  cairo_t *cr;

  surface = cairo_linuxfb_surface_create(NULL);
  cr = cairo_create(surface);
  
  cairo_paint(cr);

  cairo_select_font_face(cr, "serif", CAIRO_FONT_SLANT_NORMAL,
			 CAIRO_FONT_WEIGHT_BOLD);
  cairo_set_font_size(cr, 80.0);
  cairo_set_source_rgb(cr, 1.0, 0.0, 1.0);
  cairo_move_to(cr, 00.0, 100.0);
  cairo_show_text(cr, "Hello");

  cairo_set_source_rgb(cr, 0.0, 1.0, 0.0);
  cairo_move_to(cr, 00.0, 180.0);
  cairo_show_text(cr, "World!");

  cairo_destroy(cr);
  cairo_surface_destroy(surface);

  return 0;
}
开发者ID:mjoldfield,项目名称:seabass,代码行数:26,代码来源:fb.c


示例15: selectFontFace_func

static bool
selectFontFace_func(JSContext *context,
                    unsigned   argc,
                    JS::Value *vp)
{
    GJS_GET_PRIV(context, argc, vp, argv, obj, GjsCairoContext, priv);
    char *family;
    cairo_font_slant_t slant;
    cairo_font_weight_t weight;
    cairo_t *cr = priv ? priv->cr : NULL;

    if (!gjs_parse_call_args(context, "selectFontFace", argv, "sii",
                             "family", &family,
                             "slang", &slant,
                             "weight", &weight))
        return false;

    cairo_select_font_face(cr, family, slant, weight);
    g_free(family);

    if (!gjs_cairo_check_status(context, cairo_status(cr), "context"))
        return false;
    argv.rval().setUndefined();

    return true;
}
开发者ID:GNOME,项目名称:gjs,代码行数:26,代码来源:cairo-context.cpp


示例16: sem_render_game

void sem_render_game(sem_render_context* ctx, sem_game* game) {
	cairo_select_font_face(ctx->cr, "Railway", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
	cairo_rectangle(ctx->cr, 0, 0, ctx->width, ctx->height);
	cairo_set_source_rgb(ctx->cr, 0, 0, 0);
	cairo_fill(ctx->cr);

	cairo_save(ctx->cr);
	cairo_rectangle(ctx->cr, 0, 0, ctx->width - ctx->panel_width, ctx->height);
	cairo_clip(ctx->cr);
	cairo_save(ctx->cr);
	cairo_translate(ctx->cr, ctx->x, ctx->y);
	cairo_scale(ctx->cr, ctx->scale, ctx->scale);
	cairo_set_line_width(ctx->cr, 0.1);
	cairo_set_font_size(ctx->cr, 0.7);
	cairo_set_source_rgb(ctx->cr, 1.0, 1.0, 1.0);
	render_world(ctx, game);
	cairo_restore(ctx->cr);	
	cairo_restore(ctx->cr);	

	cairo_save(ctx->cr);
	cairo_translate(ctx->cr, ctx->width - ctx->panel_width, 0);
	char buf[128] = "";
	snprintf(buf, sizeof(buf), "%d", game->revenue.balance);
	cairo_move_to(ctx->cr, 0, 32);
	cairo_set_font_size(ctx->cr, 24);
	cairo_set_source_rgb(ctx->cr, 1.0, 1.0, 1.0);
	cairo_show_text(ctx->cr, buf);
	cairo_restore(ctx->cr);	
}
开发者ID:hertzsprung,项目名称:semaphore,代码行数:29,代码来源:sem_render.c


示例17: draw

static void
draw (cairo_t *cr, int width, int height)
{
    int i, j, h;
    unsigned char s[2] = {0, 0};

    /* clear background */
    cairo_set_source_rgb (cr, 1.0, 1.0, 1.0); /* white */
    cairo_paint (cr);

    cairo_set_source_rgb (cr, 0, 0, 0);
    cairo_select_font_face (cr,
			    "@cairo:",
			    CAIRO_FONT_SLANT_NORMAL,
			    CAIRO_FONT_WEIGHT_NORMAL);

    h = 2;
    for (i = 8; i < 48; i >= 24 ? i+=3 : i++) {
	cairo_set_font_size (cr, i);
	for (j = 33; j < 128; j++) {
	    if (j == 33 || (j == 80 && i > 24)) {
		h += i + 2;
		cairo_move_to (cr, 10, h);
	    }
	    s[0] = j;
	    cairo_show_text (cr, (const char *) s);
	}
    }
}
开发者ID:AZed,项目名称:cairo,代码行数:29,代码来源:twin.c


示例18: on_badge_draw

static gboolean on_badge_draw(ClutterCanvas* canvas, cairo_t* cr,
        gint width, gint height, ClutterActor* badge)
{
    g_debug("%s: %d,%d, ", __func__, width, height);

    cairo_set_antialias(cr, CAIRO_ANTIALIAS_BEST);
    cairo_set_operator(cr, CAIRO_OPERATOR_OVER);
    cairo_set_source_rgba(cr, 0.0, 0.0, 0.0, 1.0);
    cairo_paint_with_alpha(cr, 0.0);

    cairo_arc(cr, width/2, height/2, MIN(width, height)/2.0, 0, 2*M_PI);
    cairo_close_path(cr);

    cairo_set_operator(cr, CAIRO_OPERATOR_OVER);
    cairo_set_source_rgba(cr, 0.6, 0.2, 0.2, 0.8);
    cairo_fill(cr);

    char title[20];
    snprintf(title, 19, "%d", GPOINTER_TO_INT(g_object_get_qdata(G_OBJECT(badge), moses_overview_window_clone_order())));
    cairo_set_source_rgba(cr, 1.0, 1.0, 1.0, 1.0);

    cairo_select_font_face(cr, "fantasy", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
    cairo_set_font_size(cr, 28.0);

    cairo_text_extents_t te;
    cairo_text_extents(cr, title, &te);
    cairo_move_to(cr, (width - te.width)/2.0 - te.x_bearing, (height - te.height)/2.0 - te.y_bearing);
    cairo_show_text(cr, title);

    return TRUE;
}
开发者ID:AOSC-Dev,项目名称:elsa-shell,代码行数:31,代码来源:overview.c


示例19: draw

static cairo_test_status_t
draw (cairo_t *cr, int width, int height)
{
    cairo_glyph_t glyphs[NUM_GLYPHS];
    int i;

    /* Initialize our giant array of glyphs. */
    for (i=0; i < NUM_GLYPHS; i++) {
	glyphs[i].index = GLYPH_INDEX;
	glyphs[i].x = 1.0;
	glyphs[i].y = height - 1;
    }

    /* Paint white background. */
    cairo_set_source_rgb (cr, 1.0, 1.0, 1.0); /* white */
    cairo_paint (cr);

    cairo_select_font_face (cr, "Bitstream Vera Sans Mono",
			    CAIRO_FONT_SLANT_NORMAL,
			    CAIRO_FONT_WEIGHT_NORMAL);
    cairo_set_font_size (cr, TEXT_SIZE);

    cairo_show_glyphs (cr, glyphs, NUM_GLYPHS);

    return CAIRO_TEST_SUCCESS;
}
开发者ID:Dirbaio,项目名称:libgdiplus,代码行数:26,代码来源:show-glyphs-many.c


示例20: addWayPath

void WayRenderer::shield(cairo_t* cr,
		std::list<shared_ptr<Shield> >& shields,
		AssetCache& cache)
{
	if (s->shield_text.str().size() == 0 || s->font_size <= 0.0)
		return;

	// make sure path is initialized
	addWayPath(cr);
	cairo_new_path(cr);

	cairo_save(cr);

	cairo_set_font_size(cr, s->font_size);

	cairo_select_font_face(cr,
				s->font_family.c_str(),
				s->font_style == Style::STYLE_ITALIC ? CAIRO_FONT_SLANT_ITALIC : CAIRO_FONT_SLANT_NORMAL,
				s->font_weight == Style::WEIGHT_BOLD ? CAIRO_FONT_WEIGHT_BOLD : CAIRO_FONT_WEIGHT_NORMAL
			);

	cairo_text_extents_t textSize;
	cairo_text_extents(cr, s->shield_text.c_str(), &textSize);

	std::list<FloatPoint> positions;
	getShieldPosition(path, positions);

	for (FloatPoint& p : positions)
	{
		addShield(shields, p, &textSize);
	}

	cairo_restore(cr);
}
开发者ID:alacarte-maps,项目名称:alacarte,代码行数:34,代码来源:way_renderer.cpp



注:本文中的cairo_select_font_face函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ cairo_set_antialias函数代码示例发布时间:2022-05-30
下一篇:
C++ cairo_scaled_font_destroy函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap