Eine aufbereitete Darstellung der Quelle

 
     
 
 
Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 

Benutzer

Quelle  testfontoptions.c

  Sprache: C
 

#include <gtk/gtk.h>

G_GNUC_BEGIN_IGNORE_DEPRECATIONS

static GtkWidget *antialias;
static GtkWidget *subpixel;
static GtkWidget *hintstyle;

static void
set_font_options (GtkWidget *label)
{
  cairo_antialias_t aa;
  cairo_subpixel_order_t sp;
  cairo_hint_style_t hs;
  cairo_font_options_t *options;

  aa = gtk_combo_box_get_active (GTK_COMBO_BOX (antialias));
  sp = gtk_combo_box_get_active (GTK_COMBO_BOX (subpixel));
  hs = gtk_combo_box_get_active (GTK_COMBO_BOX (hintstyle));

  options = cairo_font_options_create ();
  cairo_font_options_set_antialias (options, aa);
  cairo_font_options_set_subpixel_order (options, sp);
  cairo_font_options_set_hint_style (options, hs);

  gtk_widget_set_font_options (label, options);
  cairo_font_options_destroy (options);

  gtk_widget_queue_draw (label);
}

int
main (int argc, char *argv[])
{
  GtkWidget *window, *label, *grid, *demo;

  gtk_init ();

  window = gtk_window_new ();
  grid = gtk_grid_new ();
  gtk_grid_set_row_spacing (GTK_GRID (grid), 10);
  gtk_grid_set_column_spacing (GTK_GRID (grid), 10);
  gtk_window_set_child (GTK_WINDOW (window), grid);
  label = gtk_label_new ("Default font options");
  gtk_grid_attach (GTK_GRID (grid), label, 0021);
  demo = gtk_label_new ("Custom font options");
  gtk_grid_attach (GTK_GRID (grid), demo, 0121);

  antialias = gtk_combo_box_text_new ();
  gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (antialias), "Default");
  gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (antialias), "None");
  gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (antialias), "Gray");
  gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (antialias), "Subpixel");
  gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (antialias), "Fast");
  gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (antialias), "Good");
  gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (antialias), "Best");
  g_signal_connect_swapped (antialias, "changed", G_CALLBACK (set_font_options), demo);
  label = gtk_label_new ("Antialias");
  gtk_grid_attach (GTK_GRID (grid), label, 0211);
  gtk_grid_attach (GTK_GRID (grid), antialias, 1211);

  subpixel = gtk_combo_box_text_new ();
  gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (subpixel), "Default");
  gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (subpixel), "RGB");
  gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (subpixel), "BGR");
  gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (subpixel), "Vertical RGB");
  gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (subpixel), "Vertical BGR");
  g_signal_connect_swapped (subpixel, "changed", G_CALLBACK (set_font_options), demo);
  label = gtk_label_new ("Subpixel");
  gtk_grid_attach (GTK_GRID (grid), label, 0311);
  gtk_grid_attach (GTK_GRID (grid), subpixel, 1311);

  hintstyle = gtk_combo_box_text_new ();
  gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (hintstyle), "Default");
  gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (hintstyle), "None");
  gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (hintstyle), "Slight");
  gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (hintstyle), "Medium");
  gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (hintstyle), "Full");
  g_signal_connect_swapped (hintstyle, "changed", G_CALLBACK (set_font_options), demo);
  label = gtk_label_new ("Hintstyle");
  gtk_grid_attach (GTK_GRID (grid), label, 0411);
  gtk_grid_attach (GTK_GRID (grid), hintstyle, 1411);

  gtk_combo_box_set_active (GTK_COMBO_BOX (antialias), 0);
  gtk_combo_box_set_active (GTK_COMBO_BOX (subpixel), 0);
  gtk_combo_box_set_active (GTK_COMBO_BOX (hintstyle), 0);

  gtk_window_present (GTK_WINDOW (window));

  while (TRUE)
    g_main_context_iteration (NULL, TRUE);

  return 0;
}

Messung V0.5 in Prozent
C=98 H=90 G=94

¤ Dauer der Verarbeitung: 0.13 Sekunden  (vorverarbeitet am  2026-07-02) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Software

     Quellcodebibliothek
     Eigene Quellcodes
     Fremde Quellcodes
     Suchen

Aktivitäten

     Artikel über Sicherheit
     Anleitung zur Aktivierung von SSL

Muße

     Gedichte
     Musik
     Bilder

Jenseits des Üblichen ....

Besucherstatistik

Besucherstatistik