/src/wrappers/cairo/library/cairo_scaled_font.e

http://github.com/tybor/Liberty · Specman e · 387 lines · 67 code · 24 blank · 296 comment · 2 complexity · 18a9227f813c2190a301b2a6e858f713 MD5 · raw file

  1. note
  2. description: "Scaled Fonts -- Caching metrics for a particular font size."
  3. copyright: "[
  4. Copyright (C) 2007-2017: Paolo Redaelli, GTK+ team
  5. This library is free software; you can redistribute it and/or
  6. modify it under the terms of the GNU Lesser General Public License
  7. as published by the Free Software Foundation; either version 2.1 of
  8. the License, or (at your option) any later version.
  9. This library is distributed in the hope that it will be useful, but
  10. WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. Lesser General Public License for more details.
  13. You should have received a copy of the GNU Lesser General Public
  14. License along with this library; if not, write to the Free Software
  15. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  16. 02110-1301 USA
  17. ]"
  18. wrapped_version: "1.2.4"
  19. class CAIRO_SCALED_FONT
  20. -- A CAIRO_SCALED_FONT is a font scaled to a particular size and
  21. -- device resolution. It is most useful for low-level font usage
  22. -- where a library or application wants to cache a reference to a
  23. -- scaled font to speed up the computation of metrics.
  24. -- TODO: mostly unimplemented
  25. inherit C_STRUCT
  26. create {ANY} from_external_pointer
  27. feature {} -- Creation
  28. -- --------------------------------------------------------------------------
  29. --
  30. -- cairo_scaled_font_create ()
  31. --
  32. -- cairo_scaled_font_t* cairo_scaled_font_create
  33. -- (cairo_font_face_t *font_face,
  34. -- const cairo_matrix_t *font_matrix,
  35. -- const cairo_matrix_t *ctm,
  36. -- const cairo_font_options_t *options);
  37. --
  38. -- Creates a cairo_scaled_font_t object from a font face and matrices that
  39. -- describe the size of the font and the environment in which it will be
  40. -- used.
  41. --
  42. -- font_face : a cairo_font_face_t
  43. -- font_matrix : font space to user space transformation matrix for the font.
  44. -- In the simplest case of a N point font, this matrix is just
  45. -- a scale by N, but it can also be used to shear the font or
  46. -- stretch it unequally along the two axes. See
  47. -- cairo_set_font_matrix().
  48. -- ctm : user to device transformation matrix with which the font
  49. -- will be used.
  50. -- options : options to use when getting metrics for the font and
  51. -- rendering with it.
  52. -- Returns : a newly created cairo_scaled_font_t. Destroy with
  53. -- cairo_scaled_font_destroy()
  54. --
  55. -- --------------------------------------------------------------------------
  56. --
  57. -- cairo_scaled_font_reference ()
  58. --
  59. -- cairo_scaled_font_t* cairo_scaled_font_reference
  60. -- (cairo_scaled_font_t *scaled_font);
  61. --
  62. -- Increases the reference count on scaled_font by one. This prevents
  63. -- scaled_font from being destroyed until a matching call to
  64. -- cairo_scaled_font_destroy() is made.
  65. --
  66. -- scaled_font : a cairo_scaled_font_t, (may be NULL in which case this
  67. -- function does nothing)
  68. -- Returns : the referenced cairo_scaled_font_t
  69. --
  70. -- --------------------------------------------------------------------------
  71. --
  72. -- cairo_scaled_font_destroy ()
  73. --
  74. -- void cairo_scaled_font_destroy (cairo_scaled_font_t *scaled_font);
  75. --
  76. -- Decreases the reference count on font by one. If the result is zero, then
  77. -- font and all associated resources are freed. See
  78. -- cairo_scaled_font_reference().
  79. --
  80. -- scaled_font : a cairo_scaled_font_t
  81. --
  82. -- --------------------------------------------------------------------------
  83. --
  84. -- cairo_scaled_font_status ()
  85. --
  86. -- cairo_status_t cairo_scaled_font_status (cairo_scaled_font_t *scaled_font);
  87. --
  88. -- Checks whether an error has previously occurred for this scaled_font.
  89. --
  90. -- scaled_font : a cairo_scaled_font_t
  91. -- Returns : CAIRO_STATUS_SUCCESS or another error such as
  92. -- CAIRO_STATUS_NO_MEMORY.
  93. --
  94. -- --------------------------------------------------------------------------
  95. --
  96. -- cairo_font_extents_t
  97. --
  98. -- typedef struct {
  99. -- double ascent;
  100. -- double descent;
  101. -- double height;
  102. -- double max_x_advance;
  103. -- double max_y_advance;
  104. -- } cairo_font_extents_t;
  105. --
  106. -- The cairo_font_extents_t structure stores metric information for a font.
  107. -- Values are given in the current user-space coordinate system.
  108. --
  109. -- Because font metrics are in user-space coordinates, they are mostly, but
  110. -- not entirely, independent of the current transformation matrix. If you
  111. -- call cairo_scale(cr, 2.0, 2.0), text will be drawn twice as big, but the
  112. -- reported text extents will not be doubled. They will change slightly due
  113. -- to hinting (so you can't assume that metrics are independent of the
  114. -- transformation matrix), but otherwise will remain unchanged.
  115. --
  116. -- double ascent; the distance that the font extends above the
  117. -- baseline. Note that this is not always exactly equal
  118. -- to the maximum of the extents of all the glyphs in
  119. -- the font, but rather is picked to express the font
  120. -- designer's intent as to how the font should align
  121. -- with elements above it.
  122. -- double descent; the distance that the font extends below the
  123. -- baseline. This value is positive for typical fonts
  124. -- that include portions below the baseline. Note that
  125. -- this is not always exactly equal to the maximum of
  126. -- the extents of all the glyphs in the font, but
  127. -- rather is picked to express the font designer's
  128. -- intent as to how the the font should align with
  129. -- elements below it.
  130. -- double height; the recommended vertical distance between baselines
  131. -- when setting consecutive lines of text with the
  132. -- font. This is greater than ascent+descent by a
  133. -- quantity known as the line spacing or external
  134. -- leading. When space is at a premium, most fonts can
  135. -- be set with only a distance of ascent+descent
  136. -- between lines.
  137. -- double max_x_advance; the maximum distance in the X direction that the the
  138. -- origin is advanced for any glyph in the font.
  139. -- double max_y_advance; the maximum distance in the Y direction that the the
  140. -- origin is advanced for any glyph in the font. this
  141. -- will be zero for normal fonts used for horizontal
  142. -- writing. (The scripts of East Asia are sometimes
  143. -- written vertically.)
  144. --
  145. -- --------------------------------------------------------------------------
  146. --
  147. -- cairo_scaled_font_extents ()
  148. --
  149. -- void cairo_scaled_font_extents (cairo_scaled_font_t *scaled_font,
  150. -- cairo_font_extents_t *extents);
  151. --
  152. -- Gets the metrics for a cairo_scaled_font_t.
  153. --
  154. -- scaled_font : a cairo_scaled_font_t
  155. -- extents : a cairo_font_extents_t which to store the retrieved extents.
  156. --
  157. -- --------------------------------------------------------------------------
  158. --
  159. -- cairo_text_extents_t
  160. --
  161. -- typedef struct {
  162. -- double x_bearing;
  163. -- double y_bearing;
  164. -- double width;
  165. -- double height;
  166. -- double x_advance;
  167. -- double y_advance;
  168. -- } cairo_text_extents_t;
  169. --
  170. -- The cairo_text_extents_t structure stores the extents of a single glyph or
  171. -- a string of glyphs in user-space coordinates. Because text extents are in
  172. -- user-space coordinates, they are mostly, but not entirely, independent of
  173. -- the current transformation matrix. If you call cairo_scale(cr, 2.0, 2.0),
  174. -- text will be drawn twice as big, but the reported text extents will not be
  175. -- doubled. They will change slightly due to hinting (so you can't assume
  176. -- that metrics are independent of the transformation matrix), but otherwise
  177. -- will remain unchanged.
  178. --
  179. -- double x_bearing; the horizontal distance from the origin to the leftmost
  180. -- part of the glyphs as drawn. Positive if the glyphs lie
  181. -- entirely to the right of the origin.
  182. -- double y_bearing; the vertical distance from the origin to the topmost
  183. -- part of the glyphs as drawn. Positive only if the glyphs
  184. -- lie completely below the origin; will usually be
  185. -- negative.
  186. -- double width; width of the glyphs as drawn
  187. -- double height; height of the glyphs as drawn
  188. -- double x_advance; distance to advance in the X direction after drawing
  189. -- these glyphs
  190. -- double y_advance; distance to advance in the Y direction after drawing
  191. -- these glyphs. Will typically be zero except for vertical
  192. -- text layout as found in East-Asian languages.
  193. --
  194. -- --------------------------------------------------------------------------
  195. --
  196. -- cairo_scaled_font_text_extents ()
  197. --
  198. -- void cairo_scaled_font_text_extents (cairo_scaled_font_t *scaled_font,
  199. -- const char *utf8,
  200. -- cairo_text_extents_t *extents);
  201. --
  202. -- Gets the extents for a string of text. The extents describe a user-space
  203. -- rectangle that encloses the "inked" portion of the text drawn at the
  204. -- origin (0,0) (as it would be drawn by cairo_show_text() if the cairo
  205. -- graphics state were set to the same font_face, font_matrix, ctm, and
  206. -- font_options as scaled_font). Additionally, the x_advance and y_advance
  207. -- values indicate the amount by which the current point would be advanced by
  208. -- cairo_show_text().
  209. --
  210. -- Note that whitespace characters do not directly contribute to the size of
  211. -- the rectangle (extents.width and extents.height). They do contribute
  212. -- indirectly by changing the position of non-whitespace characters. In
  213. -- particular, trailing whitespace characters are likely to not affect the
  214. -- size of the rectangle, though they will affect the x_advance and y_advance
  215. -- values.
  216. --
  217. -- scaled_font : a cairo_scaled_font_t
  218. -- utf8 : a string of text, encoded in UTF-8
  219. -- extents : a cairo_text_extents_t which to store the retrieved extents.
  220. --
  221. -- Since 1.2
  222. --
  223. -- --------------------------------------------------------------------------
  224. --
  225. -- cairo_scaled_font_glyph_extents ()
  226. --
  227. -- void cairo_scaled_font_glyph_extents (cairo_scaled_font_t *scaled_font,
  228. -- cairo_glyph_t *glyphs,
  229. -- int num_glyphs,
  230. -- cairo_text_extents_t *extents);
  231. --
  232. -- Gets the extents for an array of glyphs. The extents describe a user-space
  233. -- rectangle that encloses the "inked" portion of the glyphs, (as they would
  234. -- be drawn by cairo_show_glyphs() if the cairo graphics state were set to
  235. -- the same font_face, font_matrix, ctm, and font_options as scaled_font).
  236. -- Additionally, the x_advance and y_advance values indicate the amount by
  237. -- which the current point would be advanced by cairo_show_glyphs.
  238. --
  239. -- Note that whitespace glyphs do not contribute to the size of the rectangle
  240. -- (extents.width and extents.height).
  241. --
  242. -- scaled_font : a cairo_scaled_font_t
  243. -- glyphs : an array of glyph IDs with X and Y offsets.
  244. -- num_glyphs : the number of glyphs in the glyphs array
  245. -- extents : a cairo_text_extents_t which to store the retrieved extents.
  246. --
  247. -- --------------------------------------------------------------------------
  248. --
  249. -- cairo_scaled_font_get_font_face ()
  250. --
  251. -- cairo_font_face_t* cairo_scaled_font_get_font_face
  252. -- (cairo_scaled_font_t *scaled_font);
  253. --
  254. -- Gets the font face that this scaled font was created for.
  255. --
  256. -- scaled_font : a cairo_scaled_font_t
  257. -- Returns : The cairo_font_face_t with which scaled_font was created.
  258. --
  259. -- Since 1.2
  260. --
  261. -- --------------------------------------------------------------------------
  262. --
  263. -- cairo_scaled_font_get_font_options ()
  264. --
  265. -- void cairo_scaled_font_get_font_options
  266. -- (cairo_scaled_font_t *scaled_font,
  267. -- cairo_font_options_t *options);
  268. --
  269. -- Stores the font options with which scaled_font was created into options.
  270. --
  271. -- scaled_font : a cairo_scaled_font_t
  272. -- options : return value for the font options
  273. --
  274. -- Since 1.2
  275. --
  276. -- --------------------------------------------------------------------------
  277. --
  278. -- cairo_scaled_font_get_font_matrix ()
  279. --
  280. -- void cairo_scaled_font_get_font_matrix
  281. -- (cairo_scaled_font_t *scaled_font,
  282. -- cairo_matrix_t *font_matrix);
  283. --
  284. -- Stores the font matrix with which scaled_font was created into matrix.
  285. --
  286. -- scaled_font : a cairo_scaled_font_t
  287. -- font_matrix : return value for the matrix
  288. --
  289. -- Since 1.2
  290. --
  291. -- --------------------------------------------------------------------------
  292. --
  293. -- cairo_scaled_font_get_ctm ()
  294. --
  295. -- void cairo_scaled_font_get_ctm (cairo_scaled_font_t *scaled_font,
  296. -- cairo_matrix_t *ctm);
  297. --
  298. -- Stores the CTM with which scaled_font was created into ctm.
  299. --
  300. -- scaled_font : a cairo_scaled_font_t
  301. -- ctm : return value for the CTM
  302. --
  303. -- Since 1.2
  304. --
  305. -- --------------------------------------------------------------------------
  306. --
  307. -- cairo_scaled_font_get_type ()
  308. --
  309. -- cairo_font_type_t cairo_scaled_font_get_type
  310. -- (cairo_scaled_font_t *scaled_font);
  311. --
  312. -- This function returns the type of the backend used to create a scaled
  313. -- font. See cairo_font_type_t for available types.
  314. --
  315. -- scaled_font : a cairo_scaled_font_t
  316. -- Returns : The type of scaled_font.
  317. --
  318. -- Since 1.2
  319. feature {ANY} -- Memory handling
  320. dispose do free(handle) end
  321. feature {ANY} -- size
  322. struct_size: INTEGER
  323. external "C inline use <cairo.h>"
  324. alias "sizeof(cairo_scaled_font_t)"
  325. end
  326. feature {} -- External calls
  327. cairo_scaled_font_create (a_font_face, a_font_matrix, a_ctm_matrix, some_font_options: POINTER): POINTER
  328. external "C use <cairo.h>"
  329. end
  330. cairo_scaled_font_reference (a_scaled_font: POINTER): POINTER
  331. external "C use <cairo.h>"
  332. end
  333. cairo_scaled_font_destroy (a_scaled_font: POINTER)
  334. external "C use <cairo.h>"
  335. end
  336. cairo_scaled_font_status (a_scaled_font: POINTER): INTEGER
  337. external "C use <cairo.h>"
  338. end
  339. cairo_scaled_font_extents (a_scaled_font, an_extents: POINTER)
  340. external "C use <cairo.h>"
  341. end
  342. cairo_scaled_font_text_extents (a_scaled_font, an_utf8, an_extents: POINTER)
  343. external "C use <cairo.h>"
  344. end
  345. cairo_scaled_font_glyph_extents (a_scaled_font, some_glyphs: POINTER; a_glyph_num: INTEGER; some_extents: POINTER)
  346. external "C use <cairo.h>"
  347. end
  348. cairo_scaled_font_get_font_face (a_scaled_font: POINTER): POINTER
  349. external "C use <cairo.h>"
  350. end
  351. cairo_scaled_font_get_font_options (a_scaled_font, a_font_options: POINTER)
  352. external "C use <cairo.h>"
  353. end
  354. cairo_scaled_font_get_font_matrix (a_scaled_font, a_font_matrix: POINTER)
  355. external "C use <cairo.h>"
  356. end
  357. cairo_scaled_font_get_ctm (a_scaled_font, a_ctm_matrix: POINTER)
  358. external "C use <cairo.h>"
  359. end
  360. cairo_scaled_font_get_type (a_scaled_font: POINTER): INTEGER
  361. external "C use <cairo.h>"
  362. end
  363. end -- class CAIRO_SCALED_FONT