cd_text.e 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683
  1. deferred class CD_TEXT
  2. -- A raster text using a font with styles. The position the text is drawn
  3. -- depends on the text alignment attribute.
  4. --
  5. -- The library has at least 4 standard typefaces: "System" (which depends on
  6. -- the driver and platform), "Courier" (mono spaced with serif), "Times"
  7. -- (proportional with serif) and "Helvetica" (proportional without serif). Each
  8. -- typeface can have some styles: Plain, Bold, Italic and a combination of Bold
  9. -- and Italic. As an alternative to the standard typefaces, you can use other
  10. -- typefaces or native driver typefaces with the function "set_native_font", but
  11. -- they may work in a reduced set of drivers.
  12. --
  13. -- You may retrieve the dimensions of the selected font with function
  14. -- "get_font_dim". Also you may retrieve the bounding box of a specific text
  15. -- before drawing by using the "get_text_size" and "get_text_box" functions.
  16. --
  17. -- The text is drawn using a reference point; you can change the alignment
  18. -- relative to this point using the "set_text_aligment" function.
  19. inherit
  20. CANVAS_DRAW
  21. feature {ANY}
  22. -- Operations
  23. draws_text (x, y: INTEGER; text: STRING)
  24. -- Draws a text in the position (x,y) according to the current font and
  25. -- text alignment. It expects an ANSI string. Can have line breaks.
  26. do
  27. int_canvas_text (cnvs, x, y, text.to_external)
  28. end
  29. draws_text_real (x, y: REAL_64; text: STRING)
  30. -- Like "draws_text" but with real coordinates.
  31. do
  32. int_canvas_c_double_text (cnvs, x, y, text.to_external)
  33. end
  34. wd_draws_text (x, y: REAL_64; text: STRING)
  35. -- Like "draws_text" but with World coordinates.
  36. do
  37. int_wd_canvas_text (cnvs, x, y, text.to_external)
  38. end
  39. -- Attributes
  40. set_font_typeface (typeface: STRING)
  41. -- The font type can be one of the standard type faces or other driver
  42. -- dependent type face. Since font face names are not a standard between
  43. -- drivers, a few names are specially handled to improve application
  44. -- portability. If you want to use names that work for all systems we
  45. -- recommend using: "Courier", "Times" and "Helvetica".
  46. -- Default: System.
  47. do
  48. int_canvas_font(cnvs, typeface.to_external, -1, 0)
  49. end
  50. get_font_typeface: STRING
  51. local
  52. t, s, z: POINTER
  53. str: STRING
  54. do
  55. int_canvas_get_font (cnvs, t, s, z)
  56. create str.from_external_copy(t)
  57. Result := str
  58. end
  59. set_font_styles (styles: INTEGER)
  60. -- Defines the style of the font. Can be a combination of:
  61. --
  62. -- 0 = Plain
  63. -- 1 = Bold
  64. -- 2 = Italic
  65. -- 4 = Underline
  66. -- 8 = Strikeout
  67. --
  68. -- Only the Windows and PDF drivers support underline and strikeout.
  69. -- For example to define Bold and Italic, use 1|2 (bitwise logical
  70. -- inclusive). Default: 0 (Plain).
  71. local
  72. p: POINTER
  73. do
  74. int_canvas_font(cnvs, p, styles, 0)
  75. end
  76. get_font_styles: INTEGER
  77. local
  78. p, si: POINTER
  79. s: INTEGER
  80. do
  81. int_canvas_get_font (cnvs, p, $s, si)
  82. Result := s
  83. end
  84. set_font_size (size: INTEGER)
  85. -- The size is provided in points (1/72 inch) or in pixels (using negative
  86. -- values).
  87. -- Default: 12.
  88. local
  89. p: POINTER
  90. do
  91. int_canvas_font(cnvs, p, -1, size)
  92. end
  93. get_font_size: INTEGER
  94. local
  95. p, st: POINTER
  96. s: INTEGER
  97. do
  98. int_canvas_get_font (cnvs, p, st, $s)
  99. Result := s
  100. end
  101. set_wd_font_size (size: REAL_64)
  102. -- Size is specified in millimeters, but is internally converted
  103. -- to points.
  104. local
  105. p: POINTER
  106. do
  107. int_wd_canvas_font(cnvs, p, -1, size)
  108. end
  109. get_wd_font_styles: REAL_64
  110. local
  111. p, st: POINTER
  112. s: REAL_64
  113. do
  114. int_wd_canvas_get_font (cnvs, p, st, $s)
  115. Result := s
  116. end
  117. set_native_font (format: STRING)
  118. local
  119. p: POINTER
  120. do
  121. p := int_canvas_native_font(cnvs, format.to_external)
  122. end
  123. get_previous_native_font: STRING
  124. -- Selects a font based on a string description. The description can
  125. -- depend on the driver and the platform, but a common definition is
  126. -- available for all drivers. It does not need to be stored by the
  127. -- application, as it is internally replicated by the library. The string
  128. -- is case sensitive.
  129. --
  130. -- The common format definition is similar to the the Pango library
  131. -- Font Description, used by GTK+2. It is defined as having 3 parts:
  132. -- <font family>, <font styles> <font size>. For ex: "Times, Bold 18",
  133. -- or "Arial,Helvetica, Italic Underline -24". The supported styles
  134. -- include: Bold, Italic, Underline and Strikeout. Underline,
  135. -- Strikeout, and negative pixel values are not supported by the
  136. -- standard Pango Font Description. The Pango format include many
  137. -- other definitions not supported by the CD format, they are just
  138. -- ignored.
  139. --
  140. -- The IUP "FONT" attribute internal formats are also accepted in all
  141. -- drivers and platforms.
  142. local
  143. p, s: POINTER
  144. str: STRING
  145. do
  146. s := int_canvas_native_font (cnvs, p)
  147. create str.from_external_copy(s)
  148. Result := str
  149. end
  150. get_current_native_font: STRING
  151. local
  152. p: POINTER
  153. v, str: STRING
  154. do
  155. v := "(char*)CD_QUERY"
  156. p := int_canvas_native_font (cnvs, v.to_external)
  157. create str.from_external_copy(p)
  158. Result := str
  159. end
  160. set_text_alignment (value: STRING)
  161. -- Defines the vertical and horizontal alignment of a text
  162. require
  163. is_valid_alignment(value)
  164. local
  165. v: INTEGER
  166. do
  167. v := int_canvas_text_alignment(cnvs, alignment_to_int(value))
  168. end
  169. get_text_alignment: STRING
  170. local
  171. i: INTEGER
  172. do
  173. i := int_canvas_text_alignment(cnvs, -1)
  174. Result := int_to_alignment(i)
  175. end
  176. set_text_orientation (angle: REAL_64)
  177. -- Defines the text orientation, which is an angle provided in degrees
  178. -- relative to the horizontal line according to which the text is
  179. -- drawn. Default: 0.
  180. local
  181. i: REAL_64
  182. do
  183. i := int_canvas_text_orientation(cnvs, angle)
  184. end
  185. get_text_orientation: REAL_64
  186. do
  187. Result := int_canvas_text_orientation(cnvs, -1)
  188. end
  189. -- Properties
  190. get_font_dim: TUPLE[INTEGER, INTEGER, INTEGER, INTEGER]
  191. -- Returns (in this order) the maximum width of a character, the
  192. -- line's height, the ascent and descent of the characters of the
  193. -- currently selected font. The line's height is the sum of the ascent
  194. -- and descent of a given additional space (if this is the case).
  195. -- All values are given in pixels and are positive.
  196. local
  197. max_width, height, ascent, descent: INTEGER
  198. do
  199. int_canvas_get_font_dim(cnvs, $max_width, $height, $ascent, $descent)
  200. Result := [max_width, height, ascent, descent]
  201. end
  202. get_wd_font_dim: TUPLE[REAL_64, REAL_64, REAL_64, REAL_64]
  203. -- Returns (in this order) the maximum width of a character, the
  204. -- line's height, the ascent and descent of the characters of the
  205. -- currently selected font. The line's height is the sum of the ascent
  206. -- and descent of a given additional space (if this is the case).
  207. -- All values are given in millimeters and are positive.
  208. local
  209. max_width, height, ascent, descent: REAL_64
  210. do
  211. int_wd_canvas_get_font_dim(cnvs, $max_width, $height, $ascent, $descent)
  212. Result := [max_width, height, ascent, descent]
  213. end
  214. get_text_size (text: STRING): TUPLE[INTEGER, INTEGER]
  215. -- Returns the text size independent from orientation.
  216. local
  217. w, h: INTEGER
  218. do
  219. int_canvas_get_text_size(cnvs, text.to_external, $w, $h)
  220. Result := [w, h]
  221. end
  222. get_wd_text_size (text: STRING): TUPLE[REAL_64, REAL_64]
  223. -- Returns the text size, in millimeters, independent from orientation.
  224. local
  225. w, h: REAL_64
  226. do
  227. int_wd_canvas_get_text_size(cnvs, text.to_external, $w, $h)
  228. Result := [w, h]
  229. end
  230. get_text_bounds (x, y: INTEGER; text: STRING): TUPLE[INTEGER, INTEGER, INTEGER, INTEGER, INTEGER, INTEGER, INTEGER, INTEGER]
  231. -- Returns the oriented bounding rectangle occupied by a text at a given
  232. -- position. The rectangle has the same dimentions returned by feature
  233. -- get_text_size. The rectangle corners are returned in counter-clock
  234. -- wise order starting with the bottom left corner, arranged
  235. -- (x0,y0,x1,y1,x2,y2,x3,y3).
  236. local
  237. points: NATIVE_ARRAY[INTEGER]
  238. do
  239. points := points.calloc(8)
  240. points.set_all_with(0, 7)
  241. int_canvas_get_text_bounds(cnvs, x, y, text.to_external, points.to_external)
  242. Result := [points.item(0), points.item(1),
  243. points.item(2), points.item(3),
  244. points.item(4), points.item(5),
  245. points.item(6), points.item(7)]
  246. end
  247. get_text_bounds_real (x, y: REAL_64; text: STRING): TUPLE[REAL_64, REAL_64, REAL_64, REAL_64, REAL_64, REAL_64, REAL_64, REAL_64]
  248. -- Like 'get_text_bounds' but with REAL_64 values.
  249. local
  250. points: NATIVE_ARRAY[REAL_64]
  251. do
  252. points := points.calloc(8)
  253. points.set_all_with(0, 7)
  254. int_canvas_c_double_get_text_bounds(cnvs, x, y, text.to_external, points.to_external)
  255. Result := [points.item(0), points.item(1),
  256. points.item(2), points.item(3),
  257. points.item(4), points.item(5),
  258. points.item(6), points.item(7)]
  259. end
  260. get_wd_text_bounds (x, y: REAL_64; text: STRING): TUPLE[REAL_64, REAL_64, REAL_64, REAL_64, REAL_64, REAL_64, REAL_64, REAL_64]
  261. -- Like 'get_text_bounds' but using World Coordinates.
  262. local
  263. p: POINTER
  264. points: NATIVE_ARRAY[REAL_64]
  265. do
  266. points := points.calloc(8)
  267. points.set_all_with(0, 7)
  268. int_wd_canvas_get_text_bounds(cnvs, x, y, text.to_external, points.to_external)
  269. Result := [points.item(0), points.item(1),
  270. points.item(2), points.item(3),
  271. points.item(4), points.item(5),
  272. points.item(6), points.item(7)]
  273. end
  274. get_text_box (x, y: INTEGER; text: STRING): TUPLE[INTEGER, INTEGER, INTEGER, INTEGER]
  275. -- Returns the horizontal bounding rectangle occupied by a text at a
  276. -- given position. If orientation is not 0 then its area is always larger
  277. -- than the area of the rectangle returned by 'get_text_bounds'.
  278. local
  279. xmin, xmax, ymin, ymax: INTEGER
  280. do
  281. int_canvas_get_text_box(cnvs, x, y, text.to_external, $xmin, $xmax, $ymin, $ymax)
  282. Result := [xmin, xmax, ymin, ymax]
  283. end
  284. get_text_box_real (x, y: REAL_64; text: STRING): TUPLE[REAL_64, REAL_64, REAL_64, REAL_64]
  285. -- Like 'get_text_box' but using REAL_64 values.
  286. local
  287. xmin, xmax, ymin, ymax: REAL_64
  288. do
  289. int_canvas_c_double_get_text_box(cnvs, x, y, text.to_external, $xmin, $xmax, $ymin, $ymax)
  290. Result := [xmin, xmax, ymin, ymax]
  291. end
  292. get_wd_text_box (x, y: REAL_64; text: STRING): TUPLE[REAL_64, REAL_64, REAL_64, REAL_64]
  293. -- Like 'get_text_box' but using World Coordinates.
  294. local
  295. xmin, xmax, ymin, ymax: REAL_64
  296. do
  297. int_wd_canvas_get_text_box(cnvs, x, y, text.to_external, $xmin, $xmax, $ymin, $ymax)
  298. Result := [xmin, xmax, ymin, ymax]
  299. end
  300. feature {}
  301. -- Convert
  302. styles_to_int (styles: ARRAY[STRING]): INTEGER
  303. local
  304. i, x: INTEGER
  305. style: STRING
  306. do
  307. i := 0
  308. from
  309. x := 0
  310. invariant
  311. valid_style: is_valid_style (styles.item(x))
  312. until
  313. x = styles.count
  314. loop
  315. style := styles.item(x)
  316. if style.is_equal("CD_PLAIN") then
  317. i := i | 0
  318. elseif style.is_equal("CD_BOLD") then
  319. i := i | 1
  320. elseif style.is_equal("CD_ITALIC") then
  321. i := i | 2
  322. elseif style.is_equal("CD_UNDERLINE") then
  323. i := i | 4
  324. elseif style.is_equal("CD_STRIKEOUT") then
  325. i := i | 8
  326. end
  327. x := x + 1
  328. end
  329. Result := i
  330. end
  331. alignment_to_int (value: STRING): INTEGER
  332. do
  333. if value.is_equal("CD_NORTH") then
  334. Result := 0
  335. elseif value.is_equal("CD_SOUTH") then
  336. Result := 1
  337. elseif value.is_equal("CD_EAST") then
  338. Result := 2
  339. elseif value.is_equal("CD_WEST") then
  340. Result := 3
  341. elseif value.is_equal("CD_NORTH_EAST") then
  342. Result := 4
  343. elseif value.is_equal("CD_NORTH_WEST") then
  344. Result := 5
  345. elseif value.is_equal("CD_SOUTH_EAST") then
  346. Result := 6
  347. elseif value.is_equal("CD_SOUTH_WEST") then
  348. Result := 7
  349. elseif value.is_equal("CD_CENTER") then
  350. Result := 8
  351. elseif value.is_equal("CD_BASE_LEFT") then
  352. Result := 9
  353. elseif value.is_equal("CD_BASE_CENTER") then
  354. Result := 10
  355. elseif value.is_equal("CD_BASE_RIGHT") then
  356. Result := 11
  357. end
  358. end
  359. int_to_alignment (value: INTEGER): STRING
  360. do
  361. if value.is_equal(0) then
  362. Result := "CD_NORTH"
  363. elseif value.is_equal(1) then
  364. Result := "CD_SOUTH"
  365. elseif value.is_equal(2) then
  366. Result := "CD_EAST"
  367. elseif value.is_equal(3) then
  368. Result := "CD_WEST"
  369. elseif value.is_equal(4) then
  370. Result := "CD_NORTH_EAST"
  371. elseif value.is_equal(5) then
  372. Result := "CD_NORTH_WEST"
  373. elseif value.is_equal(6) then
  374. Result := "CD_SOUTH_EAST"
  375. elseif value.is_equal(7) then
  376. Result := "CD_SOUTH_WEST"
  377. elseif value.is_equal(8) then
  378. Result := "CD_CENTER"
  379. elseif value.is_equal(9) then
  380. Result := "CD_BASE_LEFT"
  381. elseif value.is_equal(10) then
  382. Result := "CD_BASE_CENTER"
  383. elseif value.is_equal(11) then
  384. Result := "CD_BASE_RIGHT"
  385. end
  386. end
  387. -- Validations
  388. is_valid_style (style: STRING): BOOLEAN
  389. do
  390. if style.is_equal("CD_PLAIN") or
  391. style.is_equal("CD_BOLD") or
  392. style.is_equal("CD_ITALIC") or
  393. style.is_equal("CD_UNDERLINE") or
  394. style.is_equal("CD_STRIKEOUT") then
  395. Result := True
  396. else
  397. Result := False
  398. end
  399. end
  400. is_valid_alignment (value: STRING): BOOLEAN
  401. do
  402. if value.is_equal("CD_NORTH") or
  403. value.is_equal("CD_SOUTH") or
  404. value.is_equal("CD_EAST") or
  405. value.is_equal("CD_WEST") or
  406. value.is_equal("CD_NORTH_EAST") or
  407. value.is_equal("CD_NORTH_WEST") or
  408. value.is_equal("CD_SOUTH_EAST") or
  409. value.is_equal("CD_SOUTH_WEST") or
  410. value.is_equal("CD_CENTER") or
  411. value.is_equal("CD_BASE_LEFT") or
  412. value.is_equal("CD_BASE_CENTER") or
  413. value.is_equal("CD_BASE_RIGHT") then
  414. Result := True
  415. else
  416. Result := False
  417. end
  418. end
  419. -- Internals
  420. int_canvas_text (wgt: POINTER; x, y: INTEGER; text: POINTER)
  421. external "plug_in"
  422. alias "{
  423. location: "${sys}/plugins"
  424. module_name: "iup"
  425. feature_name: "cdCanvasText"
  426. }"
  427. end
  428. int_canvas_c_double_text (wgt: POINTER; x, y: REAL_64; text: POINTER)
  429. external "plug_in"
  430. alias "{
  431. location: "${sys}/plugins"
  432. module_name: "iup"
  433. feature_name: "cdfCanvasText"
  434. }"
  435. end
  436. int_wd_canvas_text (wgt: POINTER; x, y: REAL_64; text: POINTER)
  437. external "plug_in"
  438. alias "{
  439. location: "${sys}/plugins"
  440. module_name: "iup"
  441. feature_name: "wdCanvasText"
  442. }"
  443. end
  444. int_canvas_font (wgt, f: POINTER; tf, fs: INTEGER)
  445. external "plug_in"
  446. alias "{
  447. location: "${sys}/plugins"
  448. module_name: "iup"
  449. feature_name: "cdCanvasFont"
  450. }"
  451. end
  452. int_wd_canvas_font (wgt, f: POINTER; tf: INTEGER; fs: REAL_64)
  453. external "plug_in"
  454. alias "{
  455. location: "${sys}/plugins"
  456. module_name: "iup"
  457. feature_name: "wdCanvasFont"
  458. }"
  459. end
  460. int_canvas_get_font (wgt, f, tf, fs: POINTER)
  461. external "plug_in"
  462. alias "{
  463. location: "${sys}/plugins"
  464. module_name: "iup"
  465. feature_name: "cdCanvasGetFont"
  466. }"
  467. end
  468. int_wd_canvas_get_font (wgt, f, tf, fs: POINTER)
  469. external "plug_in"
  470. alias "{
  471. location: "${sys}/plugins"
  472. module_name: "iup"
  473. feature_name: "wdCanvasGetFont"
  474. }"
  475. end
  476. int_canvas_native_font (wgt, sf: POINTER): POINTER
  477. external "plug_in"
  478. alias "{
  479. location: "${sys}/plugins"
  480. module_name: "iup"
  481. feature_name: "cdCanvasNativeFont"
  482. }"
  483. end
  484. int_canvas_text_alignment (wgt: POINTER; algn: INTEGER): INTEGER
  485. external "plug_in"
  486. alias "{
  487. location: "${sys}/plugins"
  488. module_name: "iup"
  489. feature_name: "cdCanvasTextAlignment"
  490. }"
  491. end
  492. int_canvas_text_orientation (wgt: POINTER; ang: REAL_64): REAL_64
  493. external "plug_in"
  494. alias "{
  495. location: "${sys}/plugins"
  496. module_name: "iup"
  497. feature_name: "cdCanvasTextOrientation"
  498. }"
  499. end
  500. int_canvas_get_font_dim (wgt, mw, h, a, d: POINTER)
  501. external "plug_in"
  502. alias "{
  503. location: "${sys}/plugins"
  504. module_name: "iup"
  505. feature_name: "cdCanvasGetFontDim"
  506. }"
  507. end
  508. int_wd_canvas_get_font_dim (wgt, mw, h, a, d: POINTER)
  509. external "plug_in"
  510. alias "{
  511. location: "${sys}/plugins"
  512. module_name: "iup"
  513. feature_name: "wdCanvasGetFontDim"
  514. }"
  515. end
  516. int_canvas_get_text_size (wgt, text, w, h: POINTER)
  517. external "plug_in"
  518. alias "{
  519. location: "${sys}/plugins"
  520. module_name: "iup"
  521. feature_name: "cdCanvasGetTextSize"
  522. }"
  523. end
  524. int_wd_canvas_get_text_size (wgt, text, w, h: POINTER)
  525. external "plug_in"
  526. alias "{
  527. location: "${sys}/plugins"
  528. module_name: "iup"
  529. feature_name: "wdCanvasGetTextSize"
  530. }"
  531. end
  532. int_canvas_get_text_bounds (wgt: POINTER; x, y: INTEGER; text, r: POINTER)
  533. external "plug_in"
  534. alias "{
  535. location: "${sys}/plugins"
  536. module_name: "iup"
  537. feature_name: "cdCanvasGetTextBounds"
  538. }"
  539. end
  540. int_canvas_c_double_get_text_bounds (wgt: POINTER; x, y: REAL_64; text, r: POINTER)
  541. external "plug_in"
  542. alias "{
  543. location: "${sys}/plugins"
  544. module_name: "iup"
  545. feature_name: "cdfCanvasGetTextBounds"
  546. }"
  547. end
  548. int_wd_canvas_get_text_bounds (wgt: POINTER; x, y: REAL_64; text, r: POINTER)
  549. external "plug_in"
  550. alias "{
  551. location: "${sys}/plugins"
  552. module_name: "iup"
  553. feature_name: "wdCanvasGetTextBounds"
  554. }"
  555. end
  556. int_canvas_get_text_box (wgt: POINTER; x, y: INTEGER; text, xmin, xmax, ymin, ymax: POINTER)
  557. external "plug_in"
  558. alias "{
  559. location: "${sys}/plugins"
  560. module_name: "iup"
  561. feature_name: "cdCanvasGetTextBox"
  562. }"
  563. end
  564. int_canvas_c_double_get_text_box (wgt: POINTER; x, y: REAL_64; text, xmin, xmax, ymin, ymax: POINTER)
  565. external "plug_in"
  566. alias "{
  567. location: "${sys}/plugins"
  568. module_name: "iup"
  569. feature_name: "cdfCanvasGetTextBox"
  570. }"
  571. end
  572. int_wd_canvas_get_text_box (wgt: POINTER; x, y: REAL_64; text, xmin, xmax, ymin, ymax: POINTER)
  573. external "plug_in"
  574. alias "{
  575. location: "${sys}/plugins"
  576. module_name: "iup"
  577. feature_name: "wdCanvasGetTextBox"
  578. }"
  579. end
  580. end
  581. -- The MIT License (MIT)
  582. -- Copyright (c) 2017 by German A. Arias
  583. -- Permission is hereby granted, free of charge, to any person obtaining a copy
  584. -- of this software and associated documentation files (the "Software"), to deal
  585. -- in the Software without restriction, including without limitation the rights
  586. -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  587. -- copies of the Software, and to permit persons to whom the Software is
  588. -- furnished to do so, subject to the following conditions:
  589. --
  590. -- The above copyright notice and this permission notice shall be included in
  591. -- all copies or substantial portions of the Software.
  592. --
  593. -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  594. -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  595. -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  596. -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  597. -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  598. -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  599. -- SOFTWARE.