/*

[Mono-patches] r55046 - trunk/mcs/class/System.Drawing/System.Drawing
Konstantin Triger (kostat at mainsoft.com) mono-patches-list at lists.ximian.com 
Wed Jan 4 04:44:47 EST 2006 

Previous message: [Mono-patches] r55045 - trunk/mcs/class/System.Web/System.Web.UI 
Next message: [Mono-patches] r55047 - trunk/mcs/class/System.Drawing/System.Drawing.Drawing2D 
Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] 

--------------------------------------------------------------------------------

Author: kostat
Date: 2006-01-04 04:44:46 -0500 (Wed, 04 Jan 2006)
New Revision: 55046

Modified:
   trunk/mcs/class/System.Drawing/System.Drawing/Graphics.jvm.cs
Log:
remove unused method

Modified: trunk/mcs/class/System.Drawing/System.Drawing/Graphics.jvm.cs
===================================================================
--- trunk/mcs/class/System.Drawing/System.Drawing/Graphics.jvm.cs	2006-01-04 07:15:30 UTC (rev 55045)
+++ trunk/mcs/class/System.Drawing/System.Drawing/Graphics.jvm.cs	2006-01-04 09:44:46 UTC (rev 55046)
@@ -407,175 +407,6 @@
 			}
 		}
 
-		internal SizeF MeasureDraw (string s, Font font, Brush brush, RectangleF layoutRectangle, StringFormat format, bool fDraw) {			
-			SizeF retVal = new SizeF(0,0);
-			awt.Graphics2D g = NativeObject;
-				
-			java.awt.Font fnt = font.NativeObject;
-			if(s != null && s.Length != 0 && fnt != null) {
-				float size = fnt.getSize();
-				float wid = layoutRectangle.Width;
-				float hei = layoutRectangle.Height;
-				float x = layoutRectangle.X;
-				float y = layoutRectangle.Y;
-				java.text.AttributedString astr = new java.text.AttributedString(s);
-				astr.addAttribute(java.awt.font.TextAttribute.FONT, fnt);
-				java.text.AttributedCharacterIterator prg = astr.getIterator();
-				java.awt.font.TextLayout textlayout = new java.awt.font.TextLayout(prg, g.getFontRenderContext());
-				int prgStart = prg.getBeginIndex();
-				int prgEnd = prg.getEndIndex();
-				java.awt.font.LineBreakMeasurer lineMeasurer = new java.awt.font.LineBreakMeasurer(
-					prg, new java.awt.font.FontRenderContext(null, false, false));
-				lineMeasurer.setPosition(prgStart);
-				float formatWidth = wid;
-				
-				//some vertical layout magic - should be reviewed
-				//				if(format != null)
-				//				{
-				//					StringFormatFlags formatflag = format.FormatFlags;
-				//					if(formatflag != StringFormatFlags.DirectionVertical)
-				//					{
-				//						if(size > (float)8 && wid > (float)13)
-				//							formatWidth = wid - (float)12;
-				//						if(formatflag ==  StringFormatFlags.DirectionRightToLeft && size == (float)6)
-				//							formatWidth = wid - (float)10;
-				//					}
-				//				}
-

*/



import java.text.*   // AttributedString, AttributedCharacterIterator
import java.awt.font.*   // LineBreakMeasurer

text
font
width

// construct an attributed string instance with the given text
java.text.AttributedString attrString = AttributedString(text);
// add font attribute to the entire text
attrString.addAttribute(java.awt.font.TextAttribute.FONT, font);
// get iterator for the attributed string
java.text.AttributedCharacterIterator it = attrString.getIterator();
int itStart = it.getBeginIndex();
int itEnd   = it.getEndIndex();
// construct a LineBreakMeasurer for the text
java.awt.font.LineBreakMeasurer lineMeasurer
	= new java.awt.font.LineBreakMeasurer(
		it,
		new java.awt.font.FontRenderContext(null, false, false)
	);
lineMeasurer.setPosition(itStart);
float formatWidth = width;


// calculate number of lines and full layout height
int lines = 0;
float layHeight = 0;
float layPrevHeight = 0;
float layWidth = 0;   // ###trenger ikke denne
java.awt.font.TextLayout layout;
//java.awt.geom.Rectangle2D bnds = new java.awt.geom.Rectangle2D.Float();
while(lineMeasurer.getPosition() < itEnd) {
	layout = lineMeasurer.nextLayout(formatWidth);
	lines++;
	//bnds = bnds.createUnion(layout.getBounds());
	layPrevHeight = layHeight;
	layHeight += layout.getDescent() + layout.getLeading() + layout.getAscent();
	float advance;
	if(   (format != null)
	   && ((format.FormatFlags & StringFormatFlags.MeasureTrailingSpaces) != 0)) {
		advance = layout.getAdvance();
	} else {
		advance = layout.getVisibleAdvance();
	}
	if(layWidth < advance) {
		layWidth = advance;
	}
	if(   (format != null)
	   && ((format.FormatFlags & StringFormatFlags.NoWrap) != 0)) {
		break;
	}
}




/*


//Overhanging parts of glyphs, and unwrapped text reaching outside 
//the formatting rectangle are allowed to show. By default all text 
//and glyph parts reaching outside the formatting rectangle are clipped.
if((lines == 1) && 
	(format != null) && 
	((format.FormatFlags & StringFormatFlags.NoClip) != 0)) {
	formatWidth = layWidth;					
}

//Only entire lines are laid out in the formatting rectangle. By default layout 
//continues until the end of the text, or until no more lines are visible as a 
//result of clipping, whichever comes first. Note that the default settings allow 
//the last line to be partially obscured by a formatting rectangle that is not a 
//whole multiple of the line height. To ensure that only whole lines are seen, specify
//this value and be careful to provide a formatting rectangle at least as tall as the 
//height of one line.
if(format != null && ((format.FormatFlags & StringFormatFlags.LineLimit) != 0) && 
	layHeight > hei && layPrevHeight < hei) {
	layHeight = layPrevHeight;
	lines--;
}






-				retVal.Height = layHeight;
-				retVal.Width = layWidth+size/2.5f;
-				if(!fDraw)
-					return retVal;
-
-				NativeObject.setPaint(brush);
-				g.setRenderingHint(awt.RenderingHints.KEY_TEXT_ANTIALIASING, awt.RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
-
-				//end measurment
-
-				//for draw we should probably update origins
-
-				//Vertical...
-				if(format != null) {
-					StringAlignment align = format.LineAlignment;
-					if(align == StringAlignment.Center) {
-						drawPosY = y + (float)hei/2 - layHeight/2;
-					}
-					else if(align == StringAlignment.Far) {
-						drawPosY = (float)y + (float)hei - layHeight;
-					}
-					//in both cases if string is not fit - switch to near
-					if(drawPosY < y)
-						drawPosY = y;
-				}
-
-				//Horisontal... on the fly
-				lineMeasurer.setPosition(prgStart);
-				float drawPosX = x;				
-				for(int line = 0;line < lines /*lineMeasurer.getPosition() < prgEnd*/;line++, drawPosY += layout.getDescent() + layout.getLeading()) {
-					layout = lineMeasurer.nextLayout(formatWidth);
-					drawPosX = x + size / (float)5;//???
-					drawPosY += layout.getAscent();
-					if(format != null) {
-						float advance;
-						if((format.FormatFlags & StringFormatFlags.MeasureTrailingSpaces) != 0)
-							advance = layout.getAdvance();
-						else
-							advance = layout.getVisibleAdvance();
-						
-						if(format.Alignment == StringAlignment.Center) {
-							drawPosX = (float)((double)x + ((double)formatWidth)/2 - advance/2);
-						}
-						else if(format.Alignment == StringAlignment.Far) {
-							drawPosX = (float)(drawPosX + formatWidth) - advance;
-						}
-						if((format.FormatFlags & StringFormatFlags.DirectionVertical ) != 0) {
-							java.awt.geom.AffineTransform at1 = java.awt.geom.AffineTransform.getTranslateInstance(
-								drawPosX +  size / (float)5, (drawPosY - layout.getAscent()) + size / (float)5);
-
-							at1.rotate(Math.PI/2);
-							awt.Shape sha = textlayout.getOutline(at1);
-							geom.AffineTransform t = GetFinalTransform();
-							if (!t.isIdentity())
-								sha = t.createTransformedShape(sha);
-							//g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
-							g.fill(sha);
-							continue;
-						}
-						if((format.FormatFlags & StringFormatFlags.DirectionRightToLeft)  != 0) {
-							drawPosX = ((drawPosX + formatWidth) - advance) + (float)9;
-							layout.draw(g, drawPosX, drawPosY);
-						} 
-					}					
-
-					geom.AffineTransform oldT = null;
-					geom.AffineTransform ft = GetFinalTransform();
-
-					//Draw current line
-					try {
-						if (!ft.isIdentity()) {
-							oldT = NativeObject.getTransform();
-							NativeObject.transform(ft);
-						}
-						layout.draw(g, drawPosX, drawPosY);					
-					}
-					finally {
-						if (oldT != null)
-							NativeObject.setTransform(oldT);
-					}
-				}
-			} //not nulls
-
-			return retVal;
-		}
 		#endregion
 
 		#region Dispose



--------------------------------------------------------------------------------


Previous message: [Mono-patches] r55045 - trunk/mcs/class/System.Web/System.Web.UI 
Next message: [Mono-patches] r55047 - trunk/mcs/class/System.Drawing/System.Drawing.Drawing2D 
Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] 

--------------------------------------------------------------------------------
More information about the Mono-patches mailing list

*/

