/// <summary> /// Return true if rhs has the same transform, antialiasing, /// and fractional metrics values as this. </summary> /// <param name="rhs"> the <code>FontRenderContext</code> to test for equality </param> /// <returns> <code>true</code> if <code>rhs</code> is equal to /// this <code>FontRenderContext</code>; <code>false</code> /// otherwise. /// @since 1.4 </returns> public virtual bool Equals(FontRenderContext rhs) { if (this == rhs) { return(true); } if (rhs == null) { return(false); } /* if neither instance is a subclass, reference values directly. */ if (!rhs.Defaulting && !Defaulting) { if (rhs.AaHintValue == AaHintValue && rhs.FmHintValue == FmHintValue) { return(Tx == null ? rhs.Tx == null : Tx.Equals(rhs.Tx)); } return(false); } else { return(rhs.AntiAliasingHint == AntiAliasingHint && rhs.FractionalMetricsHint == FractionalMetricsHint && rhs.Transform.Equals(Transform)); } }
/// <summary> /// Returns the pixel bounds of the glyph at index when this /// <code>GlyphVector</code> is rendered in a <code>Graphics</code> with the /// given <code>FontRenderContext</code> at the given location. The /// renderFRC need not be the same as the /// <code>FontRenderContext</code> of this /// <code>GlyphVector</code>, and can be null. If it is null, the /// <code>FontRenderContext</code> of this <code>GlyphVector</code> /// is used. The default implementation returns the visual bounds of the glyph, /// offset to x, y and rounded out to the next integer value, and /// ignores the FRC. Subclassers should override this method. </summary> /// <param name="index"> the index of the glyph. </param> /// <param name="renderFRC"> the <code>FontRenderContext</code> of the <code>Graphics</code>. </param> /// <param name="x"> the X position at which to render this <code>GlyphVector</code>. </param> /// <param name="y"> the Y position at which to render this <code>GlyphVector</code>. </param> /// <returns> a <code>Rectangle</code> bounding the pixels that would be affected. /// @since 1.4 </returns> public virtual Rectangle GetGlyphPixelBounds(int index, FontRenderContext renderFRC, float x, float y) { Rectangle2D rect = GetGlyphVisualBounds(index).Bounds2D; int l = (int)System.Math.Floor(rect.X + x); int t = (int)System.Math.Floor(rect.Y + y); int r = (int)System.Math.Ceiling(rect.MaxX + x); int b = (int)System.Math.Ceiling(rect.MaxY + y); return(new Rectangle(l, t, r - l, b - t)); }
internal TextLineIterator(string s, Font font, font.FontRenderContext frc, StringFormat format, float width, float height) { _format = (format != null) ? format : new StringFormat(); _font = font; _s = (s != null) ? s : String.Empty; _frc = frc; FontFamily ff = font.FontFamily; _margin = font.Size*ff.GetDrawMargin(font.Style)/ff.GetEmHeight(font.Style); _width = width; _height = height; }
internal TextLineIterator(string s, Font font, font.FontRenderContext frc, StringFormat format, float width, float height) { _format = (format != null) ? format : new StringFormat(); _font = font; _s = (s != null) ? s : String.Empty; _frc = frc; FontFamily ff = font.FontFamily; _margin = font.Size * ff.GetDrawMargin(font.Style) / ff.GetEmHeight(font.Style); _width = width; _height = height; }
/// <summary> /// Returns the pixel bounds of this <code>GlyphVector</code> when /// rendered in a graphics with the given /// <code>FontRenderContext</code> at the given location. /// </summary> public Rectangle getPixelBounds(FontRenderContext @renderFRC, float @x, float @y) { return default(Rectangle); }
/// <summary> /// Returns the pixel bounds of the glyph at index when this /// <code>GlyphVector</code> is rendered in a <code>Graphics</code> with the /// given <code>FontRenderContext</code> at the given location. /// </summary> public Rectangle getGlyphPixelBounds(int @index, FontRenderContext @renderFRC, float @x, float @y) { return default(Rectangle); }
/// <summary> /// Return true if rhs has the same transform, antialiasing, /// and fractional metrics values as this. /// </summary> public bool equals(FontRenderContext @rhs) { return default(bool); }
/// <summary> /// Return true if rhs has the same transform, antialiasing, /// and fractional metrics values as this. /// </summary> public bool equals(FontRenderContext @rhs) { return(default(bool)); }
/// <summary> /// Constructs a <code>TextMeasurer</code> from the source text. /// The source text should be a single entire paragraph. </summary> /// <param name="text"> the source paragraph. Cannot be null. </param> /// <param name="frc"> the information about a graphics device which is needed /// to measure the text correctly. Cannot be null. </param> public TextMeasurer(AttributedCharacterIterator text, FontRenderContext frc) { FFrc = frc; InitAll(text); }
/// <summary> /// Returns the pixel bounds of this <code>GlyphVector</code> when /// rendered in a graphics with the given /// <code>FontRenderContext</code> at the given location. /// </summary> public Rectangle getPixelBounds(FontRenderContext @renderFRC, float @x, float @y) { return(default(Rectangle)); }
/// <summary> /// Returns the pixel bounds of the glyph at index when this /// <code>GlyphVector</code> is rendered in a <code>Graphics</code> with the /// given <code>FontRenderContext</code> at the given location. /// </summary> public Rectangle getGlyphPixelBounds(int @index, FontRenderContext @renderFRC, float @x, float @y) { return(default(Rectangle)); }
/// <summary> /// Constructs a <code>LineBreakMeasurer</code> for the specified text. /// </summary> /// <param name="text"> the text for which this <code>LineBreakMeasurer</code> /// produces <code>TextLayout</code> objects; the text must contain /// at least one character; if the text available through /// <code>iter</code> changes, further calls to this /// <code>LineBreakMeasurer</code> instance are undefined (except, /// in some cases, when <code>insertChar</code> or /// <code>deleteChar</code> are invoked afterward - see below) </param> /// <param name="breakIter"> the <seealso cref="BreakIterator"/> which defines line /// breaks </param> /// <param name="frc"> contains information about a graphics device which is /// needed to measure the text correctly; /// text measurements can vary slightly depending on the /// device resolution, and attributes such as antialiasing; this /// parameter does not specify a translation between the /// <code>LineBreakMeasurer</code> and user space </param> /// <exception cref="IllegalArgumentException"> if the text has less than one character </exception> /// <seealso cref= LineBreakMeasurer#insertChar </seealso> /// <seealso cref= LineBreakMeasurer#deleteChar </seealso> public LineBreakMeasurer(AttributedCharacterIterator text, BreakIterator breakIter, FontRenderContext frc) { if (text.EndIndex - text.BeginIndex < 1) { throw new IllegalArgumentException("Text must contain at least one character."); } this.BreakIter = breakIter; this.Measurer = new TextMeasurer(text, frc); this.Limit = text.EndIndex; this.Pos = this.Start = text.BeginIndex; CharIter = new CharArrayIterator(Measurer.Chars, this.Start); this.BreakIter.SetText(CharIter); }
/// <summary> /// Constructs a <code>LineBreakMeasurer</code> for the specified text. /// </summary> /// <param name="text"> the text for which this <code>LineBreakMeasurer</code> /// produces <code>TextLayout</code> objects; the text must contain /// at least one character; if the text available through /// <code>iter</code> changes, further calls to this /// <code>LineBreakMeasurer</code> instance are undefined (except, /// in some cases, when <code>insertChar</code> or /// <code>deleteChar</code> are invoked afterward - see below) </param> /// <param name="frc"> contains information about a graphics device which is /// needed to measure the text correctly; /// text measurements can vary slightly depending on the /// device resolution, and attributes such as antialiasing; this /// parameter does not specify a translation between the /// <code>LineBreakMeasurer</code> and user space </param> /// <seealso cref= LineBreakMeasurer#insertChar </seealso> /// <seealso cref= LineBreakMeasurer#deleteChar </seealso> public LineBreakMeasurer(AttributedCharacterIterator text, FontRenderContext frc) : this(text, BreakIterator.LineInstance, frc) { }