From c8ba97dac7de131c5a9bb7de340b71713951e211 Mon Sep 17 00:00:00 2001 From: Dan Cummins Date: Sun, 10 Nov 2024 11:45:46 +0000 Subject: [PATCH] Added xlib example --- docs/html/classHershey_1_1String.html | 58 +++++++- docs/html/classHershey_1_1String.js | 4 +- docs/html/doxygen_crawl.html | 6 + docs/html/examples.html | 3 +- docs/html/examples.js | 3 +- docs/html/functions.html | 3 +- docs/html/functions_func.html | 3 +- docs/html/navtreeindex0.js | 13 +- docs/html/pages.html | 1 + docs/html/search/all_0.js | 3 +- docs/html/search/all_2.js | 3 +- docs/html/search/all_7.js | 5 +- docs/html/search/all_8.js | 8 +- docs/html/search/all_9.js | 6 +- docs/html/search/all_a.js | 2 +- docs/html/search/all_b.js | 3 +- docs/html/search/all_c.js | 4 + docs/html/search/all_d.js | 4 + docs/html/search/functions_3.js | 5 +- docs/html/search/functions_4.js | 5 +- docs/html/search/functions_5.js | 4 + docs/html/search/pages_0.js | 3 +- docs/html/search/pages_1.js | 2 +- docs/html/search/pages_2.js | 3 +- docs/html/search/pages_3.js | 3 +- docs/html/search/pages_4.js | 2 +- docs/html/search/pages_5.js | 2 +- docs/html/search/pages_6.js | 3 +- docs/html/search/pages_7.js | 4 + docs/html/search/pages_8.js | 5 + docs/html/search/pages_9.js | 4 + docs/html/search/pages_a.js | 4 + docs/html/search/searchdata.js | 6 +- docs/html/showhtext.html | 200 ++++++++++++++++++++++++++ docs/html/string_8hpp_source.html | 43 +++--- docs/manual/examples.dox | 1 + docs/manual/showhtext.dox | 106 ++++++++++++++ 37 files changed, 473 insertions(+), 64 deletions(-) create mode 100644 docs/html/search/all_c.js create mode 100644 docs/html/search/all_d.js create mode 100644 docs/html/search/functions_5.js create mode 100644 docs/html/search/pages_7.js create mode 100644 docs/html/search/pages_8.js create mode 100644 docs/html/search/pages_9.js create mode 100644 docs/html/search/pages_a.js create mode 100644 docs/html/showhtext.html create mode 100644 docs/manual/showhtext.dox diff --git a/docs/html/classHershey_1_1String.html b/docs/html/classHershey_1_1String.html index 2ca62a3..32c0ff0 100644 --- a/docs/html/classHershey_1_1String.html +++ b/docs/html/classHershey_1_1String.html @@ -110,9 +110,15 @@ + + + - + + + + @@ -129,8 +135,28 @@

Detailed Description

A character string comprising Hershey vector font glyphs.

Constructor & Destructor Documentation

+ +

◆ String() [1/2]

+ +
+
+

Public Member Functions

 String ()
 Create a new string.
 
 String (Font font, const char *chars)
 Create a new string of a given font.
 Create a new string of glyphs of a given font.
 
String operator+ (String rhs)
 Add two strings.
 
int get_nglyph ()
 Get the number of glyphs in the string.
 
+ + + + + + +
String::String ()
+
+ +

Create a new string.

+

The glyphs in the string.

+ +
+ -

◆ String()

+

◆ String() [2/2]

+ +

Add two strings.

+
Parameters
+ + +
rhsThe string to be appended.
+
+
+

The documentation for this class was generated from the following files: diff --git a/docs/html/functions_func.html b/docs/html/functions_func.html index 5f1e7f3..86fffa6 100644 --- a/docs/html/functions_func.html +++ b/docs/html/functions_func.html @@ -114,10 +114,11 @@
  • get_rhp() : Hershey::Glyph
  • get_width() : Hershey::Glyph, Hershey::String
  • Glyph() : Hershey::Glyph
  • +
  • operator+() : Hershey::String
  • print_coords() : Hershey::Glyph
  • print_coords_nparray() : Hershey::Glyph
  • print_info() : Hershey::Glyph
  • -
  • String() : Hershey::String
  • +
  • String() : Hershey::String
  • diff --git a/docs/html/navtreeindex0.js b/docs/html/navtreeindex0.js index 8e264d0..0210984 100644 --- a/docs/html/navtreeindex0.js +++ b/docs/html/navtreeindex0.js @@ -27,11 +27,13 @@ var NAVTREEINDEX0 = "classHershey_1_1Glyph.html#af4c254fcf01643e7ff5a62931cc108d5":[1,0,0,2,7], "classHershey_1_1Glyph.html#af531b48f6e8f2d4d3d79e8818525ad7e":[1,0,0,2,9], "classHershey_1_1String.html":[1,0,0,3], -"classHershey_1_1String.html#a45e51f6c30a0faef850250149dcf3b47":[1,0,0,3,2], -"classHershey_1_1String.html#a4802dc32db8da6c1ede3ade686997a40":[1,0,0,3,4], -"classHershey_1_1String.html#a56dd3ec6f633285819f6b801195419ae":[1,0,0,3,3], -"classHershey_1_1String.html#acfe144882f8389fa3c22b6214e162ad6":[1,0,0,3,0], -"classHershey_1_1String.html#af25f73a911a51761bb538ac624f20bd7":[1,0,0,3,1], +"classHershey_1_1String.html#a45e51f6c30a0faef850250149dcf3b47":[1,0,0,3,3], +"classHershey_1_1String.html#a4802dc32db8da6c1ede3ade686997a40":[1,0,0,3,5], +"classHershey_1_1String.html#a56dd3ec6f633285819f6b801195419ae":[1,0,0,3,4], +"classHershey_1_1String.html#a70c5d67afd1a5af1e962a25d7e5a7628":[1,0,0,3,6], +"classHershey_1_1String.html#a8a7ef356e05eb9b1ea1ab518baee3095":[1,0,0,3,0], +"classHershey_1_1String.html#acfe144882f8389fa3c22b6214e162ad6":[1,0,0,3,1], +"classHershey_1_1String.html#af25f73a911a51761bb538ac624f20bd7":[1,0,0,3,2], "classSimplex.html":[1,0,1], "classes.html":[1,1], "dir_d44c64559bbebec7f509842c48db8b23.html":[2,0,0], @@ -65,6 +67,7 @@ var NAVTREEINDEX0 = "index.html":[], "pages.html":[], "showhfont.html":[0,0], +"showhtext.html":[0,1], "string_8hpp.html":[2,0,0,6], "string_8hpp_source.html":[2,0,0,6] }; diff --git a/docs/html/pages.html b/docs/html/pages.html index 259f1e2..45de893 100644 --- a/docs/html/pages.html +++ b/docs/html/pages.html @@ -104,6 +104,7 @@
    [detail level 12]
    +
     Examples
     Viewing a font's glyphs
     Drawing to an X window
    diff --git a/docs/html/search/all_0.js b/docs/html/search/all_0.js index 42d08b8..858d308 100644 --- a/docs/html/search/all_0.js +++ b/docs/html/search/all_0.js @@ -1,4 +1,5 @@ var searchData= [ - ['a_20font_20s_20glyphs_0',['Viewing a font's glyphs',['../showhfont.html',1,'examples']]] + ['a_20font_20s_20glyphs_0',['Viewing a font's glyphs',['../showhfont.html',1,'examples']]], + ['an_20x_20window_1',['Drawing to an X window',['../showhtext.html',1,'examples']]] ]; diff --git a/docs/html/search/all_2.js b/docs/html/search/all_2.js index 65dabd2..9c61da6 100644 --- a/docs/html/search/all_2.js +++ b/docs/html/search/all_2.js @@ -2,5 +2,6 @@ var searchData= [ ['draw_5ffont_0',['draw_font',['../hershey__cairo_8hpp.html#a166e99b32a8c1013d3166452bb5c9c5b',1,'draw_font(cairo_t *cr, Hershey::Font font, int width, int height): hershey_cairo.cpp'],['../hershey__xlib_8hpp.html#a1adee9fd392f170534b86c95e07baf25',1,'draw_font(Display *display, Window *win, GC *gc, Hershey::Font font, int width, int height): hershey_xlib.cpp']]], ['draw_5fglyph_1',['draw_glyph',['../hershey__cairo_8hpp.html#af4aaa341097333121a18845f63160e6c',1,'draw_glyph(cairo_t *cr, Hershey::Glyph glyph, int x0, int y0, int scale): hershey_cairo.cpp'],['../hershey__xlib_8hpp.html#afecc775bd1a8ee515b4954724181a472',1,'draw_glyph(Display *display, Window *win, GC *gc, Hershey::Glyph glyph, int x0, int y0, int scale): hershey_xlib.cpp']]], - ['draw_5fglyphs_2',['draw_glyphs',['../hershey__cairo_8hpp.html#a586cc025596177f8c6f177c508e05c83',1,'draw_glyphs(cairo_t *cr, Hershey::String string, int x0, int y0, int scale): hershey_cairo.cpp'],['../hershey__xlib_8hpp.html#a543b2c7f6f887a21da625364187c1303',1,'draw_glyphs(Display *display, Window *win, GC *gc, Hershey::String string, int x0, int y0, int scale): hershey_xlib.cpp']]] + ['draw_5fglyphs_2',['draw_glyphs',['../hershey__cairo_8hpp.html#a586cc025596177f8c6f177c508e05c83',1,'draw_glyphs(cairo_t *cr, Hershey::String string, int x0, int y0, int scale): hershey_cairo.cpp'],['../hershey__xlib_8hpp.html#a543b2c7f6f887a21da625364187c1303',1,'draw_glyphs(Display *display, Window *win, GC *gc, Hershey::String string, int x0, int y0, int scale): hershey_xlib.cpp']]], + ['drawing_20to_20an_20x_20window_3',['Drawing to an X window',['../showhtext.html',1,'examples']]] ]; diff --git a/docs/html/search/all_7.js b/docs/html/search/all_7.js index 3d31849..0025247 100644 --- a/docs/html/search/all_7.js +++ b/docs/html/search/all_7.js @@ -1,7 +1,4 @@ var searchData= [ - ['position_0',['position',['../hershey__cairo_8hpp.html#aecf1727dd67f7d4f3d9a20c94c0d7cf9',1,'position(float fraction, float x, float X): hershey_cairo.cpp'],['../hershey__xlib_8hpp.html#aecf1727dd67f7d4f3d9a20c94c0d7cf9',1,'position(float fraction, float x, float X): hershey_cairo.cpp']]], - ['print_5fcoords_1',['print_coords',['../classHershey_1_1Glyph.html#af531b48f6e8f2d4d3d79e8818525ad7e',1,'Hershey::Glyph']]], - ['print_5fcoords_5fnparray_2',['print_coords_nparray',['../classHershey_1_1Glyph.html#aac1804714b853da669fc30a3d02aed46',1,'Hershey::Glyph']]], - ['print_5finfo_3',['print_info',['../classHershey_1_1Glyph.html#ad81cc5b0298ced291bd062b96abfc814',1,'Hershey::Glyph']]] + ['operator_2b_0',['operator+',['../classHershey_1_1String.html#a70c5d67afd1a5af1e962a25d7e5a7628',1,'Hershey::String']]] ]; diff --git a/docs/html/search/all_8.js b/docs/html/search/all_8.js index 50e5019..3d31849 100644 --- a/docs/html/search/all_8.js +++ b/docs/html/search/all_8.js @@ -1,7 +1,7 @@ var searchData= [ - ['s_20glyphs_0',['Viewing a font's glyphs',['../showhfont.html',1,'examples']]], - ['simplex_1',['Simplex',['../classSimplex.html',1,'']]], - ['string_2',['String',['../classHershey_1_1String.html',1,'Hershey::String'],['../classHershey_1_1String.html#acfe144882f8389fa3c22b6214e162ad6',1,'Hershey::String::String()']]], - ['string_2ehpp_3',['string.hpp',['../string_8hpp.html',1,'']]] + ['position_0',['position',['../hershey__cairo_8hpp.html#aecf1727dd67f7d4f3d9a20c94c0d7cf9',1,'position(float fraction, float x, float X): hershey_cairo.cpp'],['../hershey__xlib_8hpp.html#aecf1727dd67f7d4f3d9a20c94c0d7cf9',1,'position(float fraction, float x, float X): hershey_cairo.cpp']]], + ['print_5fcoords_1',['print_coords',['../classHershey_1_1Glyph.html#af531b48f6e8f2d4d3d79e8818525ad7e',1,'Hershey::Glyph']]], + ['print_5fcoords_5fnparray_2',['print_coords_nparray',['../classHershey_1_1Glyph.html#aac1804714b853da669fc30a3d02aed46',1,'Hershey::Glyph']]], + ['print_5finfo_3',['print_info',['../classHershey_1_1Glyph.html#ad81cc5b0298ced291bd062b96abfc814',1,'Hershey::Glyph']]] ]; diff --git a/docs/html/search/all_9.js b/docs/html/search/all_9.js index c299aab..99ee56f 100644 --- a/docs/html/search/all_9.js +++ b/docs/html/search/all_9.js @@ -1,5 +1,7 @@ var searchData= [ - ['vector_20fonts_0',['Hershey Vector Fonts',['../index.html',1,'']]], - ['viewing_20a_20font_20s_20glyphs_1',['Viewing a font's glyphs',['../showhfont.html',1,'examples']]] + ['s_20glyphs_0',['Viewing a font's glyphs',['../showhfont.html',1,'examples']]], + ['simplex_1',['Simplex',['../classSimplex.html',1,'']]], + ['string_2',['String',['../classHershey_1_1String.html',1,'Hershey::String'],['../classHershey_1_1String.html#a8a7ef356e05eb9b1ea1ab518baee3095',1,'Hershey::String::String()'],['../classHershey_1_1String.html#acfe144882f8389fa3c22b6214e162ad6',1,'Hershey::String::String(Font font, const char *chars)']]], + ['string_2ehpp_3',['string.hpp',['../string_8hpp.html',1,'']]] ]; diff --git a/docs/html/search/all_a.js b/docs/html/search/all_a.js index 0f9d3e0..a3d4b3c 100644 --- a/docs/html/search/all_a.js +++ b/docs/html/search/all_a.js @@ -1,4 +1,4 @@ var searchData= [ - ['usage_0',['Example usage',['../index.html#autotoc_md2',1,'']]] + ['to_20an_20x_20window_0',['Drawing to an X window',['../showhtext.html',1,'examples']]] ]; diff --git a/docs/html/search/all_b.js b/docs/html/search/all_b.js index dbd15e9..c299aab 100644 --- a/docs/html/search/all_b.js +++ b/docs/html/search/all_b.js @@ -1,4 +1,5 @@ var searchData= [ - ['viewing_20a_20font_20s_20glyphs_0',['Viewing a font's glyphs',['../showhfont.html',1,'']]] + ['vector_20fonts_0',['Hershey Vector Fonts',['../index.html',1,'']]], + ['viewing_20a_20font_20s_20glyphs_1',['Viewing a font's glyphs',['../showhfont.html',1,'examples']]] ]; diff --git a/docs/html/search/all_c.js b/docs/html/search/all_c.js new file mode 100644 index 0000000..876ee03 --- /dev/null +++ b/docs/html/search/all_c.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['window_0',['Drawing to an X window',['../showhtext.html',1,'examples']]] +]; diff --git a/docs/html/search/all_d.js b/docs/html/search/all_d.js new file mode 100644 index 0000000..0174f5f --- /dev/null +++ b/docs/html/search/all_d.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['x_20window_0',['Drawing to an X window',['../showhtext.html',1,'examples']]] +]; diff --git a/docs/html/search/functions_3.js b/docs/html/search/functions_3.js index 3d31849..0025247 100644 --- a/docs/html/search/functions_3.js +++ b/docs/html/search/functions_3.js @@ -1,7 +1,4 @@ var searchData= [ - ['position_0',['position',['../hershey__cairo_8hpp.html#aecf1727dd67f7d4f3d9a20c94c0d7cf9',1,'position(float fraction, float x, float X): hershey_cairo.cpp'],['../hershey__xlib_8hpp.html#aecf1727dd67f7d4f3d9a20c94c0d7cf9',1,'position(float fraction, float x, float X): hershey_cairo.cpp']]], - ['print_5fcoords_1',['print_coords',['../classHershey_1_1Glyph.html#af531b48f6e8f2d4d3d79e8818525ad7e',1,'Hershey::Glyph']]], - ['print_5fcoords_5fnparray_2',['print_coords_nparray',['../classHershey_1_1Glyph.html#aac1804714b853da669fc30a3d02aed46',1,'Hershey::Glyph']]], - ['print_5finfo_3',['print_info',['../classHershey_1_1Glyph.html#ad81cc5b0298ced291bd062b96abfc814',1,'Hershey::Glyph']]] + ['operator_2b_0',['operator+',['../classHershey_1_1String.html#a70c5d67afd1a5af1e962a25d7e5a7628',1,'Hershey::String']]] ]; diff --git a/docs/html/search/functions_4.js b/docs/html/search/functions_4.js index 7dd2c50..3d31849 100644 --- a/docs/html/search/functions_4.js +++ b/docs/html/search/functions_4.js @@ -1,4 +1,7 @@ var searchData= [ - ['string_0',['String',['../classHershey_1_1String.html#acfe144882f8389fa3c22b6214e162ad6',1,'Hershey::String']]] + ['position_0',['position',['../hershey__cairo_8hpp.html#aecf1727dd67f7d4f3d9a20c94c0d7cf9',1,'position(float fraction, float x, float X): hershey_cairo.cpp'],['../hershey__xlib_8hpp.html#aecf1727dd67f7d4f3d9a20c94c0d7cf9',1,'position(float fraction, float x, float X): hershey_cairo.cpp']]], + ['print_5fcoords_1',['print_coords',['../classHershey_1_1Glyph.html#af531b48f6e8f2d4d3d79e8818525ad7e',1,'Hershey::Glyph']]], + ['print_5fcoords_5fnparray_2',['print_coords_nparray',['../classHershey_1_1Glyph.html#aac1804714b853da669fc30a3d02aed46',1,'Hershey::Glyph']]], + ['print_5finfo_3',['print_info',['../classHershey_1_1Glyph.html#ad81cc5b0298ced291bd062b96abfc814',1,'Hershey::Glyph']]] ]; diff --git a/docs/html/search/functions_5.js b/docs/html/search/functions_5.js new file mode 100644 index 0000000..9213620 --- /dev/null +++ b/docs/html/search/functions_5.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['string_0',['String',['../classHershey_1_1String.html#a8a7ef356e05eb9b1ea1ab518baee3095',1,'Hershey::String::String()'],['../classHershey_1_1String.html#acfe144882f8389fa3c22b6214e162ad6',1,'Hershey::String::String(Font font, const char *chars)']]] +]; diff --git a/docs/html/search/pages_0.js b/docs/html/search/pages_0.js index 42d08b8..858d308 100644 --- a/docs/html/search/pages_0.js +++ b/docs/html/search/pages_0.js @@ -1,4 +1,5 @@ var searchData= [ - ['a_20font_20s_20glyphs_0',['Viewing a font's glyphs',['../showhfont.html',1,'examples']]] + ['a_20font_20s_20glyphs_0',['Viewing a font's glyphs',['../showhfont.html',1,'examples']]], + ['an_20x_20window_1',['Drawing to an X window',['../showhtext.html',1,'examples']]] ]; diff --git a/docs/html/search/pages_1.js b/docs/html/search/pages_1.js index 2572221..b8f3e43 100644 --- a/docs/html/search/pages_1.js +++ b/docs/html/search/pages_1.js @@ -1,4 +1,4 @@ var searchData= [ - ['examples_0',['Examples',['../examples.html',1,'']]] + ['drawing_20to_20an_20x_20window_0',['Drawing to an X window',['../showhtext.html',1,'examples']]] ]; diff --git a/docs/html/search/pages_2.js b/docs/html/search/pages_2.js index 016936b..2572221 100644 --- a/docs/html/search/pages_2.js +++ b/docs/html/search/pages_2.js @@ -1,5 +1,4 @@ var searchData= [ - ['font_20s_20glyphs_0',['Viewing a font's glyphs',['../showhfont.html',1,'examples']]], - ['fonts_1',['Hershey Vector Fonts',['../index.html',1,'']]] + ['examples_0',['Examples',['../examples.html',1,'']]] ]; diff --git a/docs/html/search/pages_3.js b/docs/html/search/pages_3.js index 4f385a4..016936b 100644 --- a/docs/html/search/pages_3.js +++ b/docs/html/search/pages_3.js @@ -1,4 +1,5 @@ var searchData= [ - ['glyphs_0',['Viewing a font's glyphs',['../showhfont.html',1,'examples']]] + ['font_20s_20glyphs_0',['Viewing a font's glyphs',['../showhfont.html',1,'examples']]], + ['fonts_1',['Hershey Vector Fonts',['../index.html',1,'']]] ]; diff --git a/docs/html/search/pages_4.js b/docs/html/search/pages_4.js index 137d454..4f385a4 100644 --- a/docs/html/search/pages_4.js +++ b/docs/html/search/pages_4.js @@ -1,4 +1,4 @@ var searchData= [ - ['hershey_20vector_20fonts_0',['Hershey Vector Fonts',['../index.html',1,'']]] + ['glyphs_0',['Viewing a font's glyphs',['../showhfont.html',1,'examples']]] ]; diff --git a/docs/html/search/pages_5.js b/docs/html/search/pages_5.js index c9a5061..137d454 100644 --- a/docs/html/search/pages_5.js +++ b/docs/html/search/pages_5.js @@ -1,4 +1,4 @@ var searchData= [ - ['s_20glyphs_0',['Viewing a font's glyphs',['../showhfont.html',1,'examples']]] + ['hershey_20vector_20fonts_0',['Hershey Vector Fonts',['../index.html',1,'']]] ]; diff --git a/docs/html/search/pages_6.js b/docs/html/search/pages_6.js index c299aab..c9a5061 100644 --- a/docs/html/search/pages_6.js +++ b/docs/html/search/pages_6.js @@ -1,5 +1,4 @@ var searchData= [ - ['vector_20fonts_0',['Hershey Vector Fonts',['../index.html',1,'']]], - ['viewing_20a_20font_20s_20glyphs_1',['Viewing a font's glyphs',['../showhfont.html',1,'examples']]] + ['s_20glyphs_0',['Viewing a font's glyphs',['../showhfont.html',1,'examples']]] ]; diff --git a/docs/html/search/pages_7.js b/docs/html/search/pages_7.js new file mode 100644 index 0000000..a3d4b3c --- /dev/null +++ b/docs/html/search/pages_7.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['to_20an_20x_20window_0',['Drawing to an X window',['../showhtext.html',1,'examples']]] +]; diff --git a/docs/html/search/pages_8.js b/docs/html/search/pages_8.js new file mode 100644 index 0000000..c299aab --- /dev/null +++ b/docs/html/search/pages_8.js @@ -0,0 +1,5 @@ +var searchData= +[ + ['vector_20fonts_0',['Hershey Vector Fonts',['../index.html',1,'']]], + ['viewing_20a_20font_20s_20glyphs_1',['Viewing a font's glyphs',['../showhfont.html',1,'examples']]] +]; diff --git a/docs/html/search/pages_9.js b/docs/html/search/pages_9.js new file mode 100644 index 0000000..876ee03 --- /dev/null +++ b/docs/html/search/pages_9.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['window_0',['Drawing to an X window',['../showhtext.html',1,'examples']]] +]; diff --git a/docs/html/search/pages_a.js b/docs/html/search/pages_a.js new file mode 100644 index 0000000..0174f5f --- /dev/null +++ b/docs/html/search/pages_a.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['x_20window_0',['Drawing to an X window',['../showhtext.html',1,'examples']]] +]; diff --git a/docs/html/search/searchdata.js b/docs/html/search/searchdata.js index a861ade..9bca438 100644 --- a/docs/html/search/searchdata.js +++ b/docs/html/search/searchdata.js @@ -1,11 +1,11 @@ var indexSectionsWithContent = { - 0: "acdefghpsv", + 0: "acdefghopstvwx", 1: "fgs", 2: "fghs", - 3: "dfgps", + 3: "dfgops", 4: "c", - 5: "aefghsv" + 5: "adefghstvwx" }; var indexSectionNames = diff --git a/docs/html/showhtext.html b/docs/html/showhtext.html new file mode 100644 index 0000000..9addaaa --- /dev/null +++ b/docs/html/showhtext.html @@ -0,0 +1,200 @@ + + + + + + + +Hershey Vector Fonts: Drawing to an X window + + + + + + + + + + + + + + + +
    +
    + + + + + + +
    +
    Hershey Vector Fonts 0.1.0 +
    +
    A C++ library for working with the Hershey vector fonts
    +
    +
    + + + + + + + + +
    +
    + +
    +
    +
    + +
    + +
    +
    + + +
    +
    +
    +
    +
    +
    Loading...
    +
    Searching...
    +
    No Matches
    +
    +
    +
    +
    + +
    +
    Drawing to an X window
    +
    +
    +

    As an example of using the X11/Xlib interface, let's create an X window and write some text on it.

    +

    hello_world_xlib.cpp

    #include "hershey.hpp"
    +
    #include "hershey_xlib.hpp"
    +
    +
    void close_x(Display *display, Window win, GC gc) {
    +
    XFreeGC(display, gc);
    +
    XDestroyWindow(display, win);
    +
    XCloseDisplay(display);
    +
    exit(1);
    +
    }
    +
    +
    int main(int argc, char *argv[]) {
    +
    +
    Hershey::Font roman("simplexroman");
    +
    Hershey::Font italic("complexitalic");
    +
    +
    Hershey::String substr1(roman, "Hello, ");
    +
    Hershey::String substr2(italic, "world!");
    +
    Hershey::String text_to_display = substr1 + substr2;
    +
    +
    Display *display;
    +
    int screen;
    +
    Window win;
    +
    GC gc;
    +
    +
    unsigned long black, white;
    +
    XEvent event;
    +
    KeySym key;
    +
    char text[255];
    +
    +
    display = XOpenDisplay((char *)0);
    +
    if(display == NULL) {
    +
    std::cout << "Error connecting to X server" << '\n';
    +
    exit(-1);
    +
    }
    +
    +
    screen = DefaultScreen(display);
    +
    black = BlackPixel(display, screen);
    +
    white = WhitePixel(display, screen);
    +
    +
    win = XCreateSimpleWindow(
    +
    display, XDefaultRootWindow(display), 0, 0, 1440, 720, 4, black, white
    +
    );
    +
    +
    XMapWindow(display, win);
    +
    XSelectInput(display, win, KeyPressMask | ButtonPressMask | ExposureMask);
    +
    +
    gc = XCreateGC(display, win, 0, 0);
    +
    XSetLineAttributes(display, gc, 1, LineSolid, CapRound, JoinRound);
    +
    +
    while(1) {
    +
    XNextEvent(display, &event);
    +
    if(event.type == Expose && !event.xexpose.count) {
    +
    draw_glyphs(display, &win, &gc, text_to_display, 360, 360, 4);
    +
    }
    +
    if(event.type == KeyPress && XLookupString(&event.xkey, text, 255, &key, 0)) {
    +
    if(text[0] == 'q') {
    +
    close_x(display, win, gc);
    +
    }
    +
    }
    +
    }
    +
    +
    return 0;
    +
    }
    +
    A Hershey vector font.
    Definition font.hpp:19
    +
    A character string comprising Hershey vector font glyphs.
    Definition string.hpp:20
    + + +

    Note that the majority of the code here is Xlib boilerplate for creating the window to draw on, as well as the colours, line style and width to draw with.

    +

    The statements using the Hershey fonts are simply:

    +
    // Load the fonts we wish to use
    +
    Hershey::Font roman("simplexroman");
    +
    Hershey::Font italic("complexitalic");
    +
    +
    // Create two strings of glyphs to draw, each with a different font
    +
    Hershey::String substr1(roman, "Hello, ");
    +
    Hershey::String substr2(italic, "world!");
    +
    +
    // Concatenate the strings
    +
    Hershey::String text_to_display = substr1 + substr2;
    +
    +
    // Draw the text starting at x=y=360, glyph sizes scaled x4
    +
    draw_glyphs(display, &win, &gc, text_to_display, 360, 360, 4);
    +

    Compile, e.g.

    +
    g++ -o hello_world_xlib -lX11 -I./include/ src/hello_world_xlib.cpp src/glyph.cpp src/font.cpp src/string.cpp src/hershey_xlib.cpp
    +
    ./hello_world_xlib
    +
    +
    +
    + + + + diff --git a/docs/html/string_8hpp_source.html b/docs/html/string_8hpp_source.html index 10af506..98202df 100644 --- a/docs/html/string_8hpp_source.html +++ b/docs/html/string_8hpp_source.html @@ -116,30 +116,35 @@
    20class String {
    21
    22 int num_glyphs;
    -
    23 Glyph glyphs[32];
    +
    23 Glyph *glyphs;
    25 public:
    -
    32 String(Font font, const char *chars);
    -
    33
    -
    39 int get_nglyph();
    -
    40
    -
    47 Glyph get_glyph(int i);
    -
    48
    -
    54 int get_width();
    -
    55
    -
    61 int get_height();
    -
    62};
    +
    29 String();
    +
    30
    +
    37 String(Font font, const char *chars);
    +
    38
    +
    44 String operator+(String rhs);
    +
    45
    +
    51 int get_nglyph();
    +
    52
    +
    59 Glyph get_glyph(int i);
    +
    60
    +
    66 int get_width();
    +
    67
    +
    73 int get_height();
    +
    74};
    -
    63} // namespace Hershey
    -
    64
    -
    65#endif
    +
    75} // namespace Hershey
    +
    76
    +
    77#endif
    A Hershey vector font.
    Definition font.hpp:19
    A Hershey vector font glyph.
    Definition glyph.hpp:18
    A character string comprising Hershey vector font glyphs.
    Definition string.hpp:20
    -
    int get_height()
    Get the height of the string.
    Definition string.cpp:28
    -
    int get_width()
    Get the width of the string.
    Definition string.cpp:20
    -
    int get_nglyph()
    Get the number of glyphs in the string.
    Definition string.cpp:12
    -
    String(Font font, const char *chars)
    Create a new string of a given font.
    Definition string.cpp:5
    -
    Glyph get_glyph(int i)
    Get a i'th glyph in the string.
    Definition string.cpp:16
    +
    int get_height()
    Get the height of the string.
    Definition string.cpp:49
    +
    int get_width()
    Get the width of the string.
    Definition string.cpp:41
    +
    int get_nglyph()
    Get the number of glyphs in the string.
    Definition string.cpp:33
    +
    String operator+(String rhs)
    Add two strings.
    Definition string.cpp:16
    +
    String()
    Create a new string.
    Definition string.cpp:5
    +
    Glyph get_glyph(int i)
    Get a i'th glyph in the string.
    Definition string.cpp:37
    diff --git a/docs/manual/examples.dox b/docs/manual/examples.dox index 694048b..8574c67 100644 --- a/docs/manual/examples.dox +++ b/docs/manual/examples.dox @@ -1,5 +1,6 @@ /*! \page examples Examples - \subpage showhfont +- \subpage showhtext */ diff --git a/docs/manual/showhtext.dox b/docs/manual/showhtext.dox new file mode 100644 index 0000000..3b5d4a2 --- /dev/null +++ b/docs/manual/showhtext.dox @@ -0,0 +1,106 @@ +/*! \page showhtext Drawing to an X window + +As an example of using the X11/Xlib interface, let's create an X window and write some text on it. + +`hello_world_xlib.cpp` +\code{.cpp} +#include "hershey.hpp" +#include "hershey_xlib.hpp" + +void close_x(Display *display, Window win, GC gc) { + XFreeGC(display, gc); + XDestroyWindow(display, win); + XCloseDisplay(display); + exit(1); +} + +int main(int argc, char *argv[]) { + + Hershey::Font roman("simplexroman"); + Hershey::Font italic("complexitalic"); + + Hershey::String substr1(roman, "Hello, "); + Hershey::String substr2(italic, "world!"); + Hershey::String text_to_display = substr1 + substr2; + + Display *display; + int screen; + Window win; + GC gc; + + unsigned long black, white; + XEvent event; + KeySym key; + char text[255]; + + display = XOpenDisplay((char *)0); + if(display == NULL) { + std::cout << "Error connecting to X server" << '\n'; + exit(-1); + } + + screen = DefaultScreen(display); + black = BlackPixel(display, screen); + white = WhitePixel(display, screen); + + win = XCreateSimpleWindow( + display, XDefaultRootWindow(display), 0, 0, 1440, 720, 4, black, white + ); + + XMapWindow(display, win); + XSelectInput(display, win, KeyPressMask | ButtonPressMask | ExposureMask); + + gc = XCreateGC(display, win, 0, 0); + XSetLineAttributes(display, gc, 1, LineSolid, CapRound, JoinRound); + + while(1) { + XNextEvent(display, &event); + if(event.type == Expose && !event.xexpose.count) { + draw_glyphs(display, &win, &gc, text_to_display, 360, 360, 4); + } + if(event.type == KeyPress && XLookupString(&event.xkey, text, 255, &key, 0)) { + if(text[0] == 'q') { + close_x(display, win, gc); + } + } + } + + return 0; +} + + +\endcode + +Note that the majority of the code here is Xlib boilerplate for creating the window to draw on, as well as the colours, line style and width to draw with. + +The statements using the Hershey fonts are simply: + +\code{.cpp} +// Load the fonts we wish to use +Hershey::Font roman("simplexroman"); +Hershey::Font italic("complexitalic"); + +// Create two strings of glyphs to draw, each with a different font +Hershey::String substr1(roman, "Hello, "); +Hershey::String substr2(italic, "world!"); + +// Concatenate the strings +Hershey::String text_to_display = substr1 + substr2; + +// Draw the text starting at x=y=360, glyph sizes scaled x4 +draw_glyphs(display, &win, &gc, text_to_display, 360, 360, 4); +\endcode + +Compile, e.g. + +\code{.sh} +g++ -o hello_world_xlib -lX11 -I./include/ src/hello_world_xlib.cpp src/glyph.cpp src/font.cpp src/string.cpp src/hershey_xlib.cpp +\endcode + +Run, e.g. + +\code{.sh} +./hello_world_xlib +\endcode + +*/