ParagraphLayout.h 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747
  1. /*
  2. **********************************************************************
  3. * Copyright (C) 2002-2014, International Business Machines
  4. * Corporation and others. All Rights Reserved.
  5. **********************************************************************
  6. */
  7. #ifndef __PARAGRAPHLAYOUT_H
  8. #define __PARAGRAPHLAYOUT_H
  9. /**
  10. * \file
  11. * \brief C++ API: Paragraph Layout
  12. */
  13. /*
  14. * ParagraphLayout doesn't make much sense without
  15. * BreakIterator...
  16. */
  17. #include "unicode/uscript.h"
  18. #if ! UCONFIG_NO_BREAK_ITERATION
  19. #include "layout/LETypes.h"
  20. #include "layout/LEFontInstance.h"
  21. #include "layout/LayoutEngine.h"
  22. #include "unicode/ubidi.h"
  23. #include "unicode/brkiter.h"
  24. #include "layout/RunArrays.h"
  25. U_NAMESPACE_BEGIN
  26. /**
  27. * ParagraphLayout.
  28. *
  29. * The <code>ParagraphLayout</code> object will analyze the text into runs of text in the
  30. * same font, script and direction, and will create a <code>LayoutEngine</code> object for each run.
  31. * The <code>LayoutEngine</code> will transform the characters into glyph codes in visual order.
  32. *
  33. * Clients can use this to break a paragraph into lines, and to display the glyphs in each line.
  34. *
  35. * Note that {@link icu::LayoutEngine} is deprecated, but this class is not.
  36. * You may use this class with the HarfBuzz icu-le-hb wrapper,
  37. * see http://www.freedesktop.org/wiki/Software/HarfBuzz/
  38. *
  39. * See http://userguide.icu-project.org/layoutengine for special build instructions.
  40. *
  41. * @see icu::LayoutEngine
  42. */
  43. class U_LAYOUTEX_API ParagraphLayout : public UObject
  44. {
  45. public:
  46. class VisualRun;
  47. /**
  48. * This class represents a single line of text in a <code>ParagraphLayout</code>. They
  49. * can only be created by calling <code>ParagraphLayout::nextLine()</code>. Each line
  50. * consists of multiple visual runs, represented by <code>ParagraphLayout::VisualRun</code>
  51. * objects.
  52. *
  53. * @see ParagraphLayout
  54. * @see ParagraphLayout::VisualRun
  55. *
  56. * @stable ICU 3.2
  57. */
  58. class U_LAYOUTEX_API Line : public UObject
  59. {
  60. public:
  61. /**
  62. * The constructor is private since these objects can only be
  63. * created by <code>ParagraphLayout</code>. However, it is the
  64. * clients responsibility to destroy the objects, so the destructor
  65. * is public.
  66. *
  67. * @stable ICU 3.2
  68. */
  69. ~Line();
  70. /**
  71. * Count the number of visual runs in the line.
  72. *
  73. * @return the number of visual runs.
  74. *
  75. * @stable ICU 3.2
  76. */
  77. inline le_int32 countRuns() const;
  78. /**
  79. * Get the ascent of the line. This is the maximum ascent
  80. * of all the fonts on the line.
  81. *
  82. * @return the ascent of the line.
  83. *
  84. * @stable ICU 3.2
  85. */
  86. le_int32 getAscent() const;
  87. /**
  88. * Get the descent of the line. This is the maximum descent
  89. * of all the fonts on the line.
  90. *
  91. * @return the descent of the line.
  92. *
  93. * @stable ICU 3.2
  94. */
  95. le_int32 getDescent() const;
  96. /**
  97. * Get the leading of the line. This is the maximum leading
  98. * of all the fonts on the line.
  99. *
  100. * @return the leading of the line.
  101. *
  102. * @stable ICU 3.2
  103. */
  104. le_int32 getLeading() const;
  105. /**
  106. * Get the width of the line. This is a convenience method
  107. * which returns the last X position of the last visual run
  108. * in the line.
  109. *
  110. * @return the width of the line.
  111. *
  112. * @stable ICU 2.8
  113. */
  114. le_int32 getWidth() const;
  115. /**
  116. * Get a <code>ParagraphLayout::VisualRun</code> object for a given
  117. * visual run in the line.
  118. *
  119. * @param runIndex is the index of the run, in visual order.
  120. *
  121. * @return the <code>ParagraphLayout::VisualRun</code> object representing the
  122. * visual run. This object is owned by the <code>Line</code> object which
  123. * created it, and will remain valid for as long as the <code>Line</code>
  124. * object is valid.
  125. *
  126. * @see ParagraphLayout::VisualRun
  127. *
  128. * @stable ICU 3.2
  129. */
  130. const VisualRun *getVisualRun(le_int32 runIndex) const;
  131. /**
  132. * ICU "poor man's RTTI", returns a UClassID for this class.
  133. *
  134. * @stable ICU 3.2
  135. */
  136. static inline UClassID getStaticClassID() { return (UClassID)&fgClassID; }
  137. /**
  138. * ICU "poor man's RTTI", returns a UClassID for the actual class.
  139. *
  140. * @stable ICU 3.2
  141. */
  142. virtual inline UClassID getDynamicClassID() const { return getStaticClassID(); }
  143. private:
  144. /**
  145. * The address of this static class variable serves as this class's ID
  146. * for ICU "poor man's RTTI".
  147. */
  148. static const char fgClassID;
  149. friend class ParagraphLayout;
  150. le_int32 fAscent;
  151. le_int32 fDescent;
  152. le_int32 fLeading;
  153. le_int32 fRunCount;
  154. le_int32 fRunCapacity;
  155. VisualRun **fRuns;
  156. inline Line();
  157. inline Line(const Line &other);
  158. inline Line &operator=(const Line & /*other*/) { return *this; };
  159. void computeMetrics();
  160. void append(const LEFontInstance *font, UBiDiDirection direction, le_int32 glyphCount,
  161. const LEGlyphID glyphs[], const float positions[], const le_int32 glyphToCharMap[]);
  162. };
  163. /**
  164. * This object represents a single visual run in a line of text in
  165. * a paragraph. A visual run is text which is in the same font,
  166. * script, and direction. The text is represented by an array of
  167. * <code>LEGlyphIDs</code>, an array of (x, y) glyph positions and
  168. * a table which maps indices into the glyph array to indices into
  169. * the original character array which was used to create the paragraph.
  170. *
  171. * These objects are only created by <code>ParagraphLayout::Line</code> objects,
  172. * so their constructors and destructors are private.
  173. *
  174. * @see ParagraphLayout::Line
  175. *
  176. * @stable ICU 3.2
  177. */
  178. class U_LAYOUTEX_API VisualRun : public UObject
  179. {
  180. public:
  181. /**
  182. * Get the <code>LEFontInstance</code> object which
  183. * represents the font of the visual run. This will always
  184. * be a non-composite font.
  185. *
  186. * @return the <code>LEFontInstance</code> object which represents the
  187. * font of the visual run.
  188. *
  189. * @see LEFontInstance
  190. *
  191. * @stable ICU 3.2
  192. */
  193. inline const LEFontInstance *getFont() const;
  194. /**
  195. * Get the direction of the visual run.
  196. *
  197. * @return the direction of the run. This will be UBIDI_LTR if the
  198. * run is left-to-right and UBIDI_RTL if the line is right-to-left.
  199. *
  200. * @stable ICU 3.2
  201. */
  202. inline UBiDiDirection getDirection() const;
  203. /**
  204. * Get the number of glyphs in the visual run.
  205. *
  206. * @return the number of glyphs.
  207. *
  208. * @stable ICU 3.2
  209. */
  210. inline le_int32 getGlyphCount() const;
  211. /**
  212. * Get the glyphs in the visual run. Glyphs with the values <code>0xFFFE</code> and
  213. * <code>0xFFFF</code> should be ignored.
  214. *
  215. * @return the address of the array of glyphs for this visual run. The storage
  216. * is owned by the <code>VisualRun</code> object and must not be deleted.
  217. * It will remain valid as long as the <code>VisualRun</code> object is valid.
  218. *
  219. * @stable ICU 3.2
  220. */
  221. inline const LEGlyphID *getGlyphs() const;
  222. /**
  223. * Get the (x, y) positions of the glyphs in the visual run. To simplify storage
  224. * management, the x and y positions are stored in a single array with the x positions
  225. * at even offsets in the array and the corresponding y position in the following odd offset.
  226. * There is an extra (x, y) pair at the end of the array which represents the advance of
  227. * the final glyph in the run.
  228. *
  229. * @return the address of the array of glyph positions for this visual run. The storage
  230. * is owned by the <code>VisualRun</code> object and must not be deleted.
  231. * It will remain valid as long as the <code>VisualRun</code> object is valid.
  232. *
  233. * @stable ICU 3.2
  234. */
  235. inline const float *getPositions() const;
  236. /**
  237. * Get the glyph-to-character map for this visual run. This maps the indices into
  238. * the glyph array to indices into the character array used to create the paragraph.
  239. *
  240. * @return the address of the character-to-glyph map for this visual run. The storage
  241. * is owned by the <code>VisualRun</code> object and must not be deleted.
  242. * It will remain valid as long as the <code>VisualRun</code> object is valid.
  243. *
  244. * @stable ICU 3.2
  245. */
  246. inline const le_int32 *getGlyphToCharMap() const;
  247. /**
  248. * A convenience method which returns the ascent value for the font
  249. * associated with this run.
  250. *
  251. * @return the ascent value of this run's font.
  252. *
  253. * @stable ICU 3.2
  254. */
  255. inline le_int32 getAscent() const;
  256. /**
  257. * A convenience method which returns the descent value for the font
  258. * associated with this run.
  259. *
  260. * @return the descent value of this run's font.
  261. *
  262. * @stable ICU 3.2
  263. */
  264. inline le_int32 getDescent() const;
  265. /**
  266. * A convenience method which returns the leading value for the font
  267. * associated with this run.
  268. *
  269. * @return the leading value of this run's font.
  270. *
  271. * @stable ICU 3.2
  272. */
  273. inline le_int32 getLeading() const;
  274. /**
  275. * ICU "poor man's RTTI", returns a UClassID for this class.
  276. *
  277. * @stable ICU 3.2
  278. */
  279. static inline UClassID getStaticClassID() { return (UClassID)&fgClassID; }
  280. /**
  281. * ICU "poor man's RTTI", returns a UClassID for the actual class.
  282. *
  283. * @stable ICU 3.2
  284. */
  285. virtual inline UClassID getDynamicClassID() const { return getStaticClassID(); }
  286. private:
  287. /**
  288. * The address of this static class variable serves as this class's ID
  289. * for ICU "poor man's RTTI".
  290. */
  291. static const char fgClassID;
  292. const LEFontInstance *fFont;
  293. const UBiDiDirection fDirection;
  294. const le_int32 fGlyphCount;
  295. const LEGlyphID *fGlyphs;
  296. const float *fPositions;
  297. const le_int32 *fGlyphToCharMap;
  298. friend class Line;
  299. inline VisualRun();
  300. inline VisualRun(const VisualRun &other);
  301. inline VisualRun &operator=(const VisualRun &/*other*/) { return *this; };
  302. inline VisualRun(const LEFontInstance *font, UBiDiDirection direction, le_int32 glyphCount,
  303. const LEGlyphID glyphs[], const float positions[], const le_int32 glyphToCharMap[]);
  304. ~VisualRun();
  305. };
  306. /**
  307. * Construct a <code>ParagraphLayout</code> object for a styled paragraph. The paragraph is specified
  308. * as runs of text all in the same font. An <code>LEFontInstance</code> object and a limit offset
  309. * are specified for each font run. The limit offset is the offset of the character immediately
  310. * after the font run.
  311. *
  312. * Clients can optionally specify directional runs and / or script runs. If these aren't specified
  313. * they will be computed.
  314. *
  315. * If any errors are encountered during construction, <code>status</code> will be set, and the object
  316. * will be set to be empty.
  317. *
  318. * @param chars is an array of the characters in the paragraph
  319. *
  320. * @param count is the number of characters in the paragraph.
  321. *
  322. * @param fontRuns a pointer to a <code>FontRuns</code> object representing the font runs.
  323. *
  324. * @param levelRuns is a pointer to a <code>ValueRuns</code> object representing the directional levels.
  325. * If this pointer in <code>NULL</code> the levels will be determined by running the Unicde
  326. * Bidi algorithm.
  327. *
  328. * @param scriptRuns is a pointer to a <code>ValueRuns</code> object representing script runs.
  329. * If this pointer in <code>NULL</code> the script runs will be determined using the
  330. * Unicode code points.
  331. *
  332. * @param localeRuns is a pointer to a <code>LocaleRuns</code> object representing locale runs.
  333. * The <code>Locale</code> objects are used to determind the language of the text. If this
  334. * pointer is <code>NULL</code> the default locale will be used for all of the text.
  335. *
  336. * @param paragraphLevel is the directionality of the paragraph, as in the UBiDi object.
  337. *
  338. * @param vertical is <code>TRUE</code> if the paragraph should be set vertically.
  339. *
  340. * @param status will be set to any error code encountered during construction.
  341. *
  342. * @see ubidi.h
  343. * @see LEFontInstance.h
  344. * @see LayoutEngine.h
  345. * @see RunArrays.h
  346. *
  347. * @stable ICU 2.8
  348. */
  349. ParagraphLayout(const LEUnicode chars[], le_int32 count,
  350. const FontRuns *fontRuns,
  351. const ValueRuns *levelRuns,
  352. const ValueRuns *scriptRuns,
  353. const LocaleRuns *localeRuns,
  354. UBiDiLevel paragraphLevel, le_bool vertical,
  355. LEErrorCode &status);
  356. /**
  357. * The destructor. Virtual so that it works correctly with
  358. * sublcasses.
  359. *
  360. * @stable ICU 3.2
  361. */
  362. ~ParagraphLayout();
  363. // Note: the following is #if 0'd out because there's no good
  364. // way to implement it without either calling layoutEngineFactory()
  365. // or duplicating the logic there...
  366. #if 0
  367. /**
  368. * Examine the given styled paragraph and determine if it contains any text which
  369. * requires complex processing. (i.e. that cannot be correctly rendered by
  370. * just mapping the characters to glyphs and rendering them in order)
  371. *
  372. * @param chars is an array of the characters in the paragraph
  373. *
  374. * @param count is the number of characters in the paragraph.
  375. *
  376. * @param fontRuns is a pointer to a <code>FontRuns</code> object representing the font runs.
  377. *
  378. * @return <code>TRUE</code> if the paragraph contains complex text.
  379. *
  380. * @stable ICU 3.2
  381. */
  382. static le_bool isComplex(const LEUnicode chars[], le_int32 count, const FontRuns *fontRuns);
  383. #else
  384. /**
  385. * Examine the given text and determine if it contains characters in any
  386. * script which requires complex processing to be rendered correctly.
  387. *
  388. * @param chars is an array of the characters in the paragraph
  389. *
  390. * @param count is the number of characters in the paragraph.
  391. *
  392. * @return <code>TRUE</code> if any of the text requires complex processing.
  393. *
  394. * @stable ICU 3.2
  395. */
  396. static le_bool isComplex(const LEUnicode chars[], le_int32 count);
  397. #endif
  398. /**
  399. * Return the resolved paragraph level. This is useful for those cases
  400. * where the bidi analysis has determined the level based on the first
  401. * strong character in the paragraph.
  402. *
  403. * @return the resolved paragraph level.
  404. *
  405. * @stable ICU 3.2
  406. */
  407. inline UBiDiLevel getParagraphLevel();
  408. /**
  409. * Return the directionality of the text in the paragraph.
  410. *
  411. * @return <code>UBIDI_LTR</code> if the text is all left to right,
  412. * <code>UBIDI_RTL</code> if the text is all right to left,
  413. * or <code>UBIDI_MIXED</code> if the text has mixed direction.
  414. *
  415. * @stable ICU 3.2
  416. */
  417. inline UBiDiDirection getTextDirection();
  418. /**
  419. * Return the max ascent value for all the fonts
  420. * in the paragraph.
  421. *
  422. * @return the ascent value.
  423. *
  424. * @stable ICU 3.2
  425. */
  426. virtual le_int32 getAscent() const;
  427. /**
  428. * Return the max descent value for all the fonts
  429. * in the paragraph.
  430. *
  431. * @return the decent value.
  432. *
  433. * @stable ICU 3.2
  434. */
  435. virtual le_int32 getDescent() const;
  436. /**
  437. * Return the max leading value for all the fonts
  438. * in the paragraph.
  439. *
  440. * @return the leading value.
  441. *
  442. * @stable ICU 3.2
  443. */
  444. virtual le_int32 getLeading() const;
  445. /**
  446. * Reset line breaking to start from the beginning of the paragraph.
  447. *
  448. *
  449. * @stable ICU 3.2
  450. */
  451. inline void reflow();
  452. #ifndef U_HIDE_INTERNAL_API
  453. /**
  454. *
  455. * Convenience method for determining if paragraph layout processing is complete ( i.e. there
  456. * are no more lines left to process. )
  457. *
  458. * @return true if there are no more lines to be processed
  459. *
  460. * @internal
  461. */
  462. inline le_bool isDone() const;
  463. #endif /* U_HIDE_INTERNAL_API */
  464. /**
  465. * Return a <code>ParagraphLayout::Line</code> object which represents next line
  466. * in the paragraph. The width of the line is specified each time so that it can
  467. * be varied to support arbitrary paragraph shapes.
  468. *
  469. * @param width is the width of the line. If <code>width</code> is less than or equal
  470. * to zero, a <code>ParagraphLayout::Line</code> object representing the
  471. * rest of the paragraph will be returned.
  472. *
  473. * @return a <code>ParagraphLayout::Line</code> object which represents the line. The caller
  474. * is responsible for deleting the object. Returns <code>NULL</code> if there are no
  475. * more lines in the paragraph.
  476. *
  477. * @see ParagraphLayout::Line
  478. *
  479. * @stable ICU 3.2
  480. */
  481. Line *nextLine(float width);
  482. /**
  483. * ICU "poor man's RTTI", returns a UClassID for this class.
  484. *
  485. * @stable ICU 3.2
  486. */
  487. static inline UClassID getStaticClassID() { return (UClassID)&fgClassID; }
  488. /**
  489. * ICU "poor man's RTTI", returns a UClassID for the actual class.
  490. *
  491. * @stable ICU 3.2
  492. */
  493. virtual inline UClassID getDynamicClassID() const { return getStaticClassID(); }
  494. private:
  495. /**
  496. * The address of this static class variable serves as this class's ID
  497. * for ICU "poor man's RTTI".
  498. */
  499. static const char fgClassID;
  500. struct StyleRunInfo
  501. {
  502. LayoutEngine *engine;
  503. const LEFontInstance *font;
  504. const Locale *locale;
  505. LEGlyphID *glyphs;
  506. float *positions;
  507. UScriptCode script;
  508. UBiDiLevel level;
  509. le_int32 runBase;
  510. le_int32 runLimit;
  511. le_int32 glyphBase;
  512. le_int32 glyphCount;
  513. };
  514. ParagraphLayout() {};
  515. ParagraphLayout(const ParagraphLayout & /*other*/) : UObject( ){};
  516. inline ParagraphLayout &operator=(const ParagraphLayout & /*other*/) { return *this; };
  517. void computeLevels(UBiDiLevel paragraphLevel);
  518. Line *computeVisualRuns();
  519. void appendRun(Line *line, le_int32 run, le_int32 firstChar, le_int32 lastChar);
  520. void computeScripts();
  521. void computeLocales();
  522. void computeSubFonts(const FontRuns *fontRuns, LEErrorCode &status);
  523. void computeMetrics();
  524. le_int32 getLanguageCode(const Locale *locale);
  525. le_int32 getCharRun(le_int32 charIndex);
  526. static le_bool isComplex(UScriptCode script);
  527. le_int32 previousBreak(le_int32 charIndex);
  528. const LEUnicode *fChars;
  529. le_int32 fCharCount;
  530. const FontRuns *fFontRuns;
  531. const ValueRuns *fLevelRuns;
  532. const ValueRuns *fScriptRuns;
  533. const LocaleRuns *fLocaleRuns;
  534. le_bool fVertical;
  535. le_bool fClientLevels;
  536. le_bool fClientScripts;
  537. le_bool fClientLocales;
  538. UBiDiLevel *fEmbeddingLevels;
  539. le_int32 fAscent;
  540. le_int32 fDescent;
  541. le_int32 fLeading;
  542. le_int32 *fGlyphToCharMap;
  543. le_int32 *fCharToMinGlyphMap;
  544. le_int32 *fCharToMaxGlyphMap;
  545. float *fGlyphWidths;
  546. le_int32 fGlyphCount;
  547. UBiDi *fParaBidi;
  548. UBiDi *fLineBidi;
  549. le_int32 *fStyleRunLimits;
  550. le_int32 *fStyleIndices;
  551. StyleRunInfo *fStyleRunInfo;
  552. le_int32 fStyleRunCount;
  553. BreakIterator *fBreakIterator;
  554. le_int32 fLineStart;
  555. le_int32 fLineEnd;
  556. le_int32 fFirstVisualRun;
  557. le_int32 fLastVisualRun;
  558. float fVisualRunLastX;
  559. float fVisualRunLastY;
  560. };
  561. inline UBiDiLevel ParagraphLayout::getParagraphLevel()
  562. {
  563. return ubidi_getParaLevel(fParaBidi);
  564. }
  565. inline UBiDiDirection ParagraphLayout::getTextDirection()
  566. {
  567. return ubidi_getDirection(fParaBidi);
  568. }
  569. inline void ParagraphLayout::reflow()
  570. {
  571. fLineEnd = 0;
  572. }
  573. inline ParagraphLayout::Line::Line()
  574. : UObject(), fAscent(0), fDescent(0), fLeading(0), fRunCount(0), fRunCapacity(0), fRuns(NULL)
  575. {
  576. // nothing else to do
  577. }
  578. inline ParagraphLayout::Line::Line(const Line & /*other*/)
  579. : UObject(), fAscent(0), fDescent(0), fLeading(0), fRunCount(0), fRunCapacity(0), fRuns(NULL)
  580. {
  581. // nothing else to do
  582. }
  583. inline le_int32 ParagraphLayout::Line::countRuns() const
  584. {
  585. return fRunCount;
  586. }
  587. inline const LEFontInstance *ParagraphLayout::VisualRun::getFont() const
  588. {
  589. return fFont;
  590. }
  591. inline UBiDiDirection ParagraphLayout::VisualRun::getDirection() const
  592. {
  593. return fDirection;
  594. }
  595. inline le_int32 ParagraphLayout::VisualRun::getGlyphCount() const
  596. {
  597. return fGlyphCount;
  598. }
  599. inline const LEGlyphID *ParagraphLayout::VisualRun::getGlyphs() const
  600. {
  601. return fGlyphs;
  602. }
  603. inline const float *ParagraphLayout::VisualRun::getPositions() const
  604. {
  605. return fPositions;
  606. }
  607. inline const le_int32 *ParagraphLayout::VisualRun::getGlyphToCharMap() const
  608. {
  609. return fGlyphToCharMap;
  610. }
  611. inline le_int32 ParagraphLayout::VisualRun::getAscent() const
  612. {
  613. return fFont->getAscent();
  614. }
  615. inline le_int32 ParagraphLayout::VisualRun::getDescent() const
  616. {
  617. return fFont->getDescent();
  618. }
  619. inline le_int32 ParagraphLayout::VisualRun::getLeading() const
  620. {
  621. return fFont->getLeading();
  622. }
  623. inline ParagraphLayout::VisualRun::VisualRun()
  624. : UObject(), fFont(NULL), fDirection(UBIDI_LTR), fGlyphCount(0), fGlyphs(NULL), fPositions(NULL), fGlyphToCharMap(NULL)
  625. {
  626. // nothing
  627. }
  628. inline ParagraphLayout::VisualRun::VisualRun(const VisualRun &/*other*/)
  629. : UObject(), fFont(NULL), fDirection(UBIDI_LTR), fGlyphCount(0), fGlyphs(NULL), fPositions(NULL), fGlyphToCharMap(NULL)
  630. {
  631. // nothing
  632. }
  633. inline ParagraphLayout::VisualRun::VisualRun(const LEFontInstance *font, UBiDiDirection direction, le_int32 glyphCount,
  634. const LEGlyphID glyphs[], const float positions[], const le_int32 glyphToCharMap[])
  635. : fFont(font), fDirection(direction), fGlyphCount(glyphCount),
  636. fGlyphs(glyphs), fPositions(positions), fGlyphToCharMap(glyphToCharMap)
  637. {
  638. // nothing else needs to be done!
  639. }
  640. U_NAMESPACE_END
  641. #endif
  642. #endif