/// <summary> /// Create Bidi from the given paragraph of text and base direction. </summary> /// <param name="paragraph"> a paragraph of text </param> /// <param name="flags"> a collection of flags that control the algorithm. The /// algorithm understands the flags DIRECTION_LEFT_TO_RIGHT, DIRECTION_RIGHT_TO_LEFT, /// DIRECTION_DEFAULT_LEFT_TO_RIGHT, and DIRECTION_DEFAULT_RIGHT_TO_LEFT. /// Other values are reserved. </param> public Bidi(String paragraph, int flags) { if (paragraph == null) { throw new IllegalArgumentException("paragraph is null"); } BidiBase = new BidiBase(paragraph.ToCharArray(), 0, null, 0, paragraph.Length(), flags); }
/// <summary> /// Create Bidi from the given paragraph of text. /// <para> /// The RUN_DIRECTION attribute in the text, if present, determines the base /// direction (left-to-right or right-to-left). If not present, the base /// direction is computes using the Unicode Bidirectional Algorithm, defaulting to left-to-right /// if there are no strong directional characters in the text. This attribute, if /// present, must be applied to all the text in the paragraph. /// </para> /// <para> /// The BIDI_EMBEDDING attribute in the text, if present, represents embedding level /// information. Negative values from -1 to -62 indicate overrides at the absolute value /// of the level. Positive values from 1 to 62 indicate embeddings. Where values are /// zero or not defined, the base embedding level as determined by the base direction /// is assumed. /// </para> /// <para> /// The NUMERIC_SHAPING attribute in the text, if present, converts European digits to /// other decimal digits before running the bidi algorithm. This attribute, if present, /// must be applied to all the text in the paragraph. /// /// </para> /// </summary> /// <param name="paragraph"> a paragraph of text with optional character and paragraph attribute information /// </param> /// <seealso cref= java.awt.font.TextAttribute#BIDI_EMBEDDING </seealso> /// <seealso cref= java.awt.font.TextAttribute#NUMERIC_SHAPING </seealso> /// <seealso cref= java.awt.font.TextAttribute#RUN_DIRECTION </seealso> public Bidi(AttributedCharacterIterator paragraph) { if (paragraph == null) { throw new IllegalArgumentException("paragraph is null"); } BidiBase = new BidiBase(0, 0); BidiBase.Para = paragraph; }
/// <summary> /// Create Bidi from the given text, embedding, and direction information. /// The embeddings array may be null. If present, the values represent embedding level /// information. Negative values from -1 to -61 indicate overrides at the absolute value /// of the level. Positive values from 1 to 61 indicate embeddings. Where values are /// zero, the base embedding level as determined by the base direction is assumed. </summary> /// <param name="text"> an array containing the paragraph of text to process. </param> /// <param name="textStart"> the index into the text array of the start of the paragraph. </param> /// <param name="embeddings"> an array containing embedding values for each character in the paragraph. /// This can be null, in which case it is assumed that there is no external embedding information. </param> /// <param name="embStart"> the index into the embedding array of the start of the paragraph. </param> /// <param name="paragraphLength"> the length of the paragraph in the text and embeddings arrays. </param> /// <param name="flags"> a collection of flags that control the algorithm. The /// algorithm understands the flags DIRECTION_LEFT_TO_RIGHT, DIRECTION_RIGHT_TO_LEFT, /// DIRECTION_DEFAULT_LEFT_TO_RIGHT, and DIRECTION_DEFAULT_RIGHT_TO_LEFT. /// Other values are reserved. </param> public Bidi(char[] text, int textStart, sbyte[] embeddings, int embStart, int paragraphLength, int flags) { if (text == null) { throw new IllegalArgumentException("text is null"); } if (paragraphLength < 0) { throw new IllegalArgumentException("bad length: " + paragraphLength); } if (textStart < 0 || paragraphLength > text.Length - textStart) { throw new IllegalArgumentException("bad range: " + textStart + " length: " + paragraphLength + " for text of length: " + text.Length); } if (embeddings != null && (embStart < 0 || paragraphLength > embeddings.Length - embStart)) { throw new IllegalArgumentException("bad range: " + embStart + " length: " + paragraphLength + " for embeddings of length: " + text.Length); } BidiBase = new BidiBase(text, textStart, embeddings, embStart, paragraphLength, flags); }