Differences

This shows you the differences between two versions of the page.

Link to this comparison view

en:bearlibterminal:reference [2017/02/28 02:45]
cfyzium
en:bearlibterminal:reference [2018/02/01 22:06] (current)
cfyzium
Line 153: Line 153:
 ==== print ==== ==== print ====
 <sxh cpp; toolbar: false; gutter: false; class-name: '​bksxh';>​ <sxh cpp; toolbar: false; gutter: false; class-name: '​bksxh';>​
-void terminal_print(int x, int y, const char* s); // + printf, wprint and wprintf flavours+dimensions_t ​terminal_print(int x, int y, const char* s); // + printf, wprint and wprintf flavours 
 +dimensions_t terminal_print_ext(int x, int y, int width, int height, int align, const char* s); // + terminal_[w]print[f]_ext
 </​sxh>​ </​sxh>​
 This function prints a string starting from given coordinates. Each individual symbol is placed separately as if by calling [[#​put]]([[#​put ext|_ext]], i. e. **print** takes full advantage of selected [[#color]], [[#layer]] and [[#​composition]] options. This function prints a string starting from given coordinates. Each individual symbol is placed separately as if by calling [[#​put]]([[#​put ext|_ext]], i. e. **print** takes full advantage of selected [[#color]], [[#layer]] and [[#​composition]] options.
 +
 +**print_ext** prints a string with optional auto-wrapping and alignment. Alignment may be one or a combination of: ''​TK_ALIGN_DEFAULT''​ (top-left), ''​TK_ALIGN_LEFT'',​ ''​TK_ALIGN_RIGHT'',​ ''​TK_ALIGN_CENTER''​ (center horizontally),​ ''​TK_ALIGN_TOP'',​ ''​TK_ALIGN_BOTTOM'',​ ''​TK_ALIGN_MIDDLE''​ (center vertically).
  
 Behavior of **print** function may be modified by a number of tags in the string: Behavior of **print** function may be modified by a number of tags in the string:
Line 171: Line 174:
 To print a single ''​[''​ or ''​]''​ bracket, just double it. To print a single ''​[''​ or ''​]''​ bracket, just double it.
  
-This function returns ​one of the dimensions ​of a string printed on screen with all formatting enabled. By default **print** returns ​the width of a longest line in a printed string. If the string contains a bounding box tag, then maximum width is considered to be already known and **print** returns the height of an auto-wrapped string printed on screen.+This function returns the size of a string printed on the screen. ​
  
 ==== measure ==== ==== measure ====
 <sxh cpp; toolbar: false; gutter: false; class-name: '​bksxh';>​ <sxh cpp; toolbar: false; gutter: false; class-name: '​bksxh';>​
-void terminal_measure(const char* s); // all [w]measure[f] flavours+dimensions_t ​terminal_measure(const char* s); // all [w]measure[f] flavours 
 +dimensions_t terminal_measure_ext(int width, int height, const char* s); // + terminal_[w]measure[f]_ext
 </​sxh>​ </​sxh>​
-This function ​calculates ​a string ​width or height (depending ​on bbox tag presencesee [[#print]]) without printing that string on screen.+This function ​returns the size a string ​would have if printed ​on the screen. **measure_ext** measures a string auto-wrapped within ​bbox (widthheight). Note that unlike ​[[#print|print_ext]] there is no alignment argument since it does not affect the size.
  
 ==== state ==== ==== state ====