public override bool ProcessMarkup(ProjectLayoutElement zElement, FormattedTextData zData, FormattedTextProcessData zProcessData, Graphics zGraphics) { int nSpaces; if (!int.TryParse(m_sVariable, out nSpaces)) { return(false); } LineNumber = zProcessData.CurrentLine; float fWidth = (float)nSpaces * ((float)zProcessData.FontSpaceWidth + (float)zElement.wordspace); if (0 == fWidth) { return(false); } if (zProcessData.CurrentX + fWidth >= zElement.width) { if (Optional) { return(false); } zProcessData.MoveToNextLine(zElement); } TargetRect = new RectangleF(zProcessData.CurrentX, zProcessData.CurrentY, fWidth, zProcessData.FontSpaceHeight); zProcessData.CurrentX += fWidth; return(true); }
public override void CloseMarkup(FormattedTextData zData, FormattedTextProcessData zProcessData, Graphics zGraphics) { if (null != m_zPreviousFont) { zProcessData.SetFont(m_zPreviousFont, zGraphics); } }
public override bool ProcessMarkup(ProjectLayoutElement zElement, FormattedTextData zData, FormattedTextProcessData zProcessData, Graphics zGraphics) { MarkupToClose.CloseMarkup(zData, zProcessData, zGraphics); // keep only the necessary markups return(s_dictionaryKeepTypesOnProcess.ContainsKey(MarkupToClose.GetType())); }
public override bool ProcessMarkup(ProjectLayoutElement zElement, FormattedTextData zData, FormattedTextProcessData zProcessData, Graphics zGraphics) { MarkupToClose.CloseMarkup(zData, zProcessData, zGraphics); // keep only the necessary markups return s_dictionaryKeepTypesOnProcess.ContainsKey(MarkupToClose.GetType()); }
public override bool ProcessMarkup(ProjectLayoutElement zElement, FormattedTextData zData, FormattedTextProcessData zProcessData, Graphics zGraphics) { var arrayComponents = m_sVariable.Split(new char[] { ';' }); if (1 > arrayComponents.Length) { return(false); } int nXPush; if (!int.TryParse(arrayComponents[0], out nXPush)) { return(false); } var nYPush = 0; if (2 <= arrayComponents.Length) { if (!int.TryParse(arrayComponents[1], out nYPush)) { return(false); } } zProcessData.CurrentX += nXPush; zProcessData.CurrentY += nYPush; if (zProcessData.CurrentX > zElement.width) { zProcessData.MoveToNextLine(zElement); } return(false); }
public override bool ProcessMarkup(ProjectLayoutElement zElement, FormattedTextData zData, FormattedTextProcessData zProcessData, Graphics zGraphics) { int nSpaces; if (!int.TryParse(m_sVariable, out nSpaces)) { return false; } LineNumber = zProcessData.CurrentLine; float fWidth = (float)nSpaces * ((float)zProcessData.FontSpaceWidth + (float)zElement.wordspace); if (0 == fWidth) { return false; } if (zProcessData.CurrentX + fWidth >= zElement.width) { if (Optional) { return false; } zProcessData.MoveToNextLine(zElement); } TargetRect = new RectangleF(zProcessData.CurrentX, zProcessData.CurrentY, fWidth, zProcessData.FontSpaceHeight); zProcessData.CurrentX += fWidth; return true; }
public override bool ProcessMarkup(ProjectLayoutElement zElement, FormattedTextData zData, FormattedTextProcessData zProcessData, Graphics zGraphics) { var arrayComponents = m_sVariable.Split(new char[] { ';' }); if (1 > arrayComponents.Length) { return false; } int nXPush; if (!int.TryParse(arrayComponents[0], out nXPush)) { return false; } var nYPush = 0; if (2 <= arrayComponents.Length) { if (!int.TryParse(arrayComponents[1], out nYPush)) { return false; } } zProcessData.CurrentX += nXPush; zProcessData.CurrentY += nYPush; if (zProcessData.CurrentX > zElement.width) { zProcessData.MoveToNextLine(zElement); } return false; }
public override bool ProcessMarkup(ProjectLayoutElement zElement, FormattedTextData zData, FormattedTextProcessData zProcessData, Graphics zGraphics) { float fYOffset; if (float.TryParse(m_sVariable, out fYOffset)) { m_fPreviousOffset = zProcessData.CurrentYOffset; zProcessData.CurrentYOffset = fYOffset; } return false; }
public override bool ProcessMarkup(ProjectLayoutElement zElement, FormattedTextData zData, FormattedTextProcessData zProcessData, Graphics zGraphics) { float fNewSize; if (float.TryParse(m_sVariable, out fNewSize) && fNewSize > 0) { m_zPreviousFont = zProcessData.Font; zProcessData.SetFont(new Font(zProcessData.Font.FontFamily, fNewSize, zProcessData.Font.Style), zGraphics); } return false; }
public override bool ProcessMarkup(ProjectLayoutElement zElement, FormattedTextData zData, FormattedTextProcessData zProcessData, Graphics zGraphics) { float fXOffset; if (float.TryParse(m_sVariable, out fXOffset)) { m_fPreviousOffset = zProcessData.CurrentXOffset; zProcessData.CurrentXOffset = fXOffset; } return(false); }
public override bool ProcessMarkup(ProjectLayoutElement zElement, FormattedTextData zData, FormattedTextProcessData zProcessData, Graphics zGraphics) { float fNewSize; if (float.TryParse(m_sVariable, out fNewSize) && fNewSize > 0) { m_zPreviousFont = zProcessData.Font; zProcessData.SetFont(new Font(zProcessData.Font.FontFamily, fNewSize, zProcessData.Font.Style), zGraphics); } return(false); }
public override bool ProcessMarkup(ProjectLayoutElement zElement, FormattedTextData zData, FormattedTextProcessData zProcessData, Graphics zGraphics) { var zNewFont = ProjectLayoutElement.TranslateFontString(m_sVariable); if (zNewFont != null) { m_zPreviousFont = zProcessData.Font; zProcessData.SetFont(zNewFont, zGraphics); return true; } return false; }
public override bool ProcessMarkup(ProjectLayoutElement zElement, FormattedTextData zData, FormattedTextProcessData zProcessData, Graphics zGraphics) { var zNewFont = ProjectLayoutElement.TranslateFontString(m_sVariable); if (zNewFont != null) { m_zPreviousFont = zProcessData.Font; zProcessData.SetFont(zNewFont, zGraphics); return(true); } return(false); }
public override bool ProcessMarkup(ProjectLayoutElement zElement, FormattedTextData zData, FormattedTextProcessData zProcessData, Graphics zGraphics) { m_zFontBrush = zProcessData.FontBrush; m_zFont = zProcessData.Font; m_fFontHeight = zProcessData.FontHeight; m_fXOffset = zProcessData.CurrentXOffset; m_fYOffset = zProcessData.CurrentYOffset; LineNumber = zProcessData.CurrentLine; m_fFontOutlineSize = m_zFont.Size; // TODO: stop recalculating this, store it in the processData if (0 != zElement.outlinethickness) { switch (m_zFont.Unit) { case GraphicsUnit.Point: m_fFontOutlineSize = zGraphics.DpiY * (m_zFont.Size / 72f); break; default: Logger.AddLogLine("This font is using the Unit: {0} (not currently supported)".FormatString(m_zFont.Unit.ToString())); break; } } m_rectMeasuredRectangle = MeasureDisplayStringWidth(zGraphics, m_sVariable, m_zFont); var fMeasuredWidth = m_rectMeasuredRectangle.Width; var fMeasuredHeight = Math.Max(m_rectMeasuredRectangle.Height, m_fFontHeight); if (zProcessData.CurrentX + fMeasuredWidth > zElement.width) { zProcessData.MoveToNextLine(zElement); } TargetRect = new RectangleF(zProcessData.CurrentX, zProcessData.CurrentY, fMeasuredWidth, fMeasuredHeight); zProcessData.CurrentX += fMeasuredWidth; return(true); }
/// <summary> /// Processes the image markup and if the image is valid associates it with the current process data. /// </summary> /// <param name="zElement"></param> /// <param name="zData"></param> /// <param name="zProcessData"></param> /// <param name="zGraphics"></param> /// <returns>false - The BackgroundImageMarkup.Render is called as part of a TextMarkup</returns> public override bool ProcessMarkup(ProjectLayoutElement zElement, FormattedTextData zData, FormattedTextProcessData zProcessData, Graphics zGraphics) { var arrayComponents = m_sVariable.Split(new char[] { ';' }); if (1 > arrayComponents.Length) { return(false); } LineNumber = zProcessData.CurrentLine; m_sImageFile = arrayComponents[0]; var zBmp = DrawItem.LoadImageFromCache(m_sImageFile); m_fXOffset = zProcessData.CurrentXOffset; m_fYOffset = zProcessData.CurrentYOffset; if (null != zBmp) { switch (arrayComponents.Length) { case 1: m_nWidth = zBmp.Width; m_nHeight = zBmp.Height; TargetRect = new RectangleF(zProcessData.CurrentX, zProcessData.CurrentY, 0, 0); return(true); case 5: { if (float.TryParse(arrayComponents[1], out m_fXOffset) && float.TryParse(arrayComponents[2], out m_fYOffset) && int.TryParse(arrayComponents[3], out m_nWidth) && int.TryParse(arrayComponents[4], out m_nHeight)) { TargetRect = new RectangleF(zProcessData.CurrentX, zProcessData.CurrentY, 0, 0); return(true); } } break; } } return(false); }
public override bool ProcessMarkup(ProjectLayoutElement zElement, FormattedTextData zData, FormattedTextProcessData zProcessData, Graphics zGraphics) { m_zFontBrush = zProcessData.FontBrush; m_zFont = zProcessData.Font; m_fFontHeight = zProcessData.FontHeight; m_fXOffset = zProcessData.CurrentXOffset; m_fYOffset = zProcessData.CurrentYOffset; LineNumber = zProcessData.CurrentLine; m_fFontOutlineSize = m_zFont.Size; // TODO: stop recalculating this, store it in the processData if (0 != zElement.outlinethickness) { switch (m_zFont.Unit) { case GraphicsUnit.Point: m_fFontOutlineSize = zGraphics.DpiY * (m_zFont.Size / 72f); break; default: Logger.AddLogLine("This font is using the Unit: {0} (not currently supported)".FormatString(m_zFont.Unit.ToString())); break; } } m_rectMeasuredRectangle = MeasureDisplayStringWidth(zGraphics, m_sVariable, m_zFont); var fMeasuredWidth = m_rectMeasuredRectangle.Width; var fMeasuredHeight = Math.Max(m_rectMeasuredRectangle.Height, m_fFontHeight); if (zProcessData.CurrentX + fMeasuredWidth > zElement.width) { zProcessData.MoveToNextLine(zElement); } TargetRect = new RectangleF(zProcessData.CurrentX, zProcessData.CurrentY, fMeasuredWidth, fMeasuredHeight); zProcessData.CurrentX += fMeasuredWidth; return true; }
/// <summary> /// Processes the image markup and if the image is valid associates it with the current process data. /// </summary> /// <param name="zElement"></param> /// <param name="zData"></param> /// <param name="zProcessData"></param> /// <param name="zGraphics"></param> /// <returns>false - The BackgroundImageMarkup.Render is called as part of a TextMarkup</returns> public override bool ProcessMarkup(ProjectLayoutElement zElement, FormattedTextData zData, FormattedTextProcessData zProcessData, Graphics zGraphics) { var arrayComponents = m_sVariable.Split(new char[] { ';' }); if (1 > arrayComponents.Length) { return false; } LineNumber = zProcessData.CurrentLine; m_sImageFile = arrayComponents[0]; var zBmp = DrawItem.LoadImageFromCache(m_sImageFile); m_fXOffset = zProcessData.CurrentXOffset; m_fYOffset = zProcessData.CurrentYOffset; if (null != zBmp) { switch (arrayComponents.Length) { case 1: m_nWidth = zBmp.Width; m_nHeight = zBmp.Height; TargetRect = new RectangleF(zProcessData.CurrentX, zProcessData.CurrentY, 0, 0); return true; case 5: { if (float.TryParse(arrayComponents[1], out m_fXOffset) && float.TryParse(arrayComponents[2], out m_fYOffset) && int.TryParse(arrayComponents[3], out m_nWidth) && int.TryParse(arrayComponents[4], out m_nHeight)) { TargetRect = new RectangleF(zProcessData.CurrentX, zProcessData.CurrentY, 0, 0); return true; } } break; } } return false; }
public override bool ProcessMarkup(ProjectLayoutElement zElement, FormattedTextData zData, FormattedTextProcessData zProcessData, Graphics zGraphics) { zProcessData.AddFontStyle(Style, zGraphics); return false; }
public override void CloseMarkup(FormattedTextData zData, FormattedTextProcessData zProcessData, Graphics zGraphics) { zProcessData.CurrentXOffset = m_fPreviousOffset; }
public static void DrawFormattedText(Graphics zGraphics, Deck zDeck, ProjectLayoutElement zElement, string sInput, Brush zBrush, Font zFont, Color colorFont) { // check the cache for this item var zDataFormattedCache = zDeck.GetCachedMarkup(zElement.name); if (null == zDataFormattedCache) { if (null == zFont) // default to something! { // font will show up in red if it's not yet set zFont = s_zDefaultFont; zBrush = Brushes.Red; } if (255 != zElement.opacity) { zBrush = new SolidBrush(Color.FromArgb(zElement.opacity, colorFont)); } zDataFormattedCache = new FormattedTextDataCache(); var zFormattedData = new FormattedTextData(GetMarkups(sInput)); var zProcessData = new FormattedTextProcessData(); // set the initial font zProcessData.FontBrush = zBrush; zProcessData.SetFont(zFont, zGraphics); var listPassMarkups = new List<MarkupBase>(); // only contains the markups that will be actively drawn (for caching) // Pass 1: // - Create rectangles // - Configure per-markup settings based on state of markup stack // - Generate list of markups to continue to process (those that are used in the next pass) // - Specify Markup rectanlges // - Generate markup rows int nIdx; MarkupBase zMarkup; for (nIdx = 0; nIdx < zFormattedData.AllMarkups.Count; nIdx++) { zMarkup = zFormattedData.AllMarkups[nIdx]; if (zMarkup.ProcessMarkup(zElement, zFormattedData, zProcessData, zGraphics)) { zMarkup.LineNumber = zProcessData.CurrentLine; listPassMarkups.Add(zMarkup); } } // Pass 2: // - Trim spaces from line endings if (listPassMarkups.Count > 0) { nIdx = listPassMarkups.Count - 1; zMarkup = listPassMarkups[nIdx]; var currentLineNumber = zMarkup.LineNumber; var bFindNextLine = false; while (nIdx > -1) { zMarkup = listPassMarkups[nIdx]; if (zMarkup.LineNumber != currentLineNumber) { currentLineNumber = zMarkup.LineNumber; bFindNextLine = false; } if (!bFindNextLine && zMarkup is SpaceMarkup && ((SpaceMarkup) zMarkup).Optional) { listPassMarkups.RemoveAt(nIdx); } else { bFindNextLine = true; } nIdx--; } } // Pass 3: // - Align lines (horizontal/vertical) // Reprocess for align (before backgroundcolor is configured) UpdateAlignment(zElement, listPassMarkups); // Pass 4: process the remaining items nIdx = 0; while (nIdx < listPassMarkups.Count) { zMarkup = listPassMarkups[nIdx]; if (!zMarkup.PostProcessMarkupRectangle(zElement, listPassMarkups, nIdx)) { listPassMarkups.RemoveAt(nIdx); nIdx--; } else { zDataFormattedCache.AddMarkup(zMarkup); } nIdx++; } // update the cache zDeck.AddCachedMarkup(zElement.name, zDataFormattedCache); } zDataFormattedCache.Render(zElement, zGraphics); }
public virtual void CloseMarkup(FormattedTextData zData, FormattedTextProcessData zProcessData, Graphics zGraphics) { }
public override void CloseMarkup(FormattedTextData zData, FormattedTextProcessData zProcessData, Graphics zGraphics) { zProcessData.RemoveFontStyle(Style, zGraphics); }
public override bool ProcessMarkup(ProjectLayoutElement zElement, FormattedTextData zData, FormattedTextProcessData zProcessData, Graphics zGraphics) { var arrayComponents = m_sVariable.Split(new char[] { ';' }); if (1 > arrayComponents.Length) { return(false); } LineNumber = zProcessData.CurrentLine; m_sImageFile = arrayComponents[0]; var zBmp = DrawItem.LoadImageFromCache(m_sImageFile); if (null == zBmp) { return(false); } var fLineHeightPercent = -1f; // SOOOOO much duplication switch (arrayComponents.Length) { case 1: TargetRect = new RectangleF(zProcessData.CurrentX, zProcessData.CurrentY, zBmp.Width, zBmp.Height); break; case 2: float.TryParse(arrayComponents[1], out fLineHeightPercent); TargetRect = new RectangleF(zProcessData.CurrentX, zProcessData.CurrentY, zBmp.Width, zBmp.Height); break; case 3: if (float.TryParse(arrayComponents[1], out m_fXOffset) && float.TryParse(arrayComponents[2], out m_fYOffset)) { TargetRect = new RectangleF(zProcessData.CurrentX, zProcessData.CurrentY, zBmp.Width, zBmp.Height); } break; case 4: float.TryParse(arrayComponents[1], out fLineHeightPercent); if (float.TryParse(arrayComponents[2], out m_fXOffset) && float.TryParse(arrayComponents[3], out m_fYOffset)) { TargetRect = new RectangleF(zProcessData.CurrentX, zProcessData.CurrentY, zBmp.Width, zBmp.Height); } break; case 5: // width and height are absolute (even overlapping drawing) { int nWidth; int nHeight; if (float.TryParse(arrayComponents[1], out m_fXOffset) && float.TryParse(arrayComponents[2], out m_fYOffset) && int.TryParse(arrayComponents[3], out nWidth) && int.TryParse(arrayComponents[4], out nHeight)) { TargetRect = new RectangleF(zProcessData.CurrentX, zProcessData.CurrentY, nWidth, nHeight); } } break; } if (TargetRect == RectangleF.Empty) { return(false); } m_fXOffset += zProcessData.CurrentXOffset; m_fYOffset += zProcessData.CurrentYOffset; if (-1f != fLineHeightPercent) { var aspectRatio = TargetRect.Width / TargetRect.Height; var fNewHeight = fLineHeightPercent * (zProcessData.FontHeight == 0f ? 1f : (float)zProcessData.FontHeight); var fNewWidth = fNewHeight * aspectRatio; TargetRect = new RectangleF(zProcessData.CurrentX, zProcessData.CurrentY, fNewWidth, fNewHeight); } // newline eval if (TargetRect.Width + TargetRect.X > zElement.width) { zProcessData.MoveToNextLine(zElement); TargetRect = new RectangleF(0, zProcessData.CurrentY, TargetRect.Width, TargetRect.Height); } // cap off excessively wide images if (TargetRect.Width + TargetRect.X > zElement.width) { TargetRect = new RectangleF(TargetRect.X, TargetRect.Y, zElement.width, TargetRect.Height); } // Center the image on the line based on font height or line height (todo figure out which...) TargetRect = new RectangleF(TargetRect.X, TargetRect.Y + (((float)zProcessData.FontHeight - (float)TargetRect.Height) / 2f), TargetRect.Width, TargetRect.Height); zProcessData.CurrentX += TargetRect.Width; return(true); }
public override bool ProcessMarkup(ProjectLayoutElement zElement, FormattedTextData zData, FormattedTextProcessData zProcessData, Graphics zGraphics) { zProcessData.MoveToNextLine(zElement); return(false); }
public override bool ProcessMarkup(ProjectLayoutElement zElement, FormattedTextData zData, FormattedTextProcessData zProcessData, Graphics zGraphics) { m_zFontBrush = zProcessData.FontBrush; m_zFont = zProcessData.Font; m_fFontHeight = zProcessData.FontHeight; m_fXOffset = zProcessData.CurrentXOffset; m_fYOffset = zProcessData.CurrentYOffset; LineNumber = zProcessData.CurrentLine; // TODO: stop recalculating this, store it in the processData if (0 != zElement.outlinethickness) { m_fFontOutlineSize = zGraphics.DpiY * (m_zFont.Size / CardMakerMDI.Instance.ApplicationDPI); } m_rectMeasuredRectangle = MeasureDisplayStringWidth(zGraphics, m_sVariable, m_zFont); var fMeasuredWidth = m_rectMeasuredRectangle.Width; if (zProcessData.CurrentX + fMeasuredWidth > zElement.width) { zProcessData.MoveToNextLine(zElement); } TargetRect = new RectangleF(zProcessData.CurrentX, zProcessData.CurrentY, fMeasuredWidth, m_rectMeasuredRectangle.Height); zProcessData.CurrentX += fMeasuredWidth; return true; }
public override bool ProcessMarkup(ProjectLayoutElement zElement, FormattedTextData zData, FormattedTextProcessData zProcessData, Graphics zGraphics) { zProcessData.MoveToNextLine(zElement); return false; }
public override bool ProcessMarkup(ProjectLayoutElement zElement, FormattedTextData zData, FormattedTextProcessData zProcessData, Graphics zGraphics) { return(true); }
public override bool ProcessMarkup(ProjectLayoutElement zElement, FormattedTextData zData, FormattedTextProcessData zProcessData, Graphics zGraphics) { zProcessData.AddFontStyle(Style, zGraphics); return(false); }
/// <summary> /// Processes the markup to determine the markup stack information (font settings, rectangle sizes/settings) /// </summary> /// <param name="zElement"></param> /// <param name="zData"></param> /// <param name="zProcessData"></param> /// <param name="zGraphics"></param> /// <returns>true if this markup is to be further processed</returns> public virtual bool ProcessMarkup(ProjectLayoutElement zElement, FormattedTextData zData, FormattedTextProcessData zProcessData, Graphics zGraphics) { return(false); }
public override void CloseMarkup(FormattedTextData zData, FormattedTextProcessData zProcessData, Graphics zGraphics) { zProcessData.FontBrush = m_zPreviousBrush; }
public override bool ProcessMarkup(ProjectLayoutElement zElement, FormattedTextData zData, FormattedTextProcessData zProcessData, Graphics zGraphics) { m_zPreviousBrush = zProcessData.FontBrush; zProcessData.FontBrush = new SolidBrush(ProjectLayoutElement.TranslateColorString(m_sVariable)); return(false); }
public override void CloseMarkup(FormattedTextData zData, FormattedTextProcessData zProcessData, Graphics zGraphics) { zProcessData.CurrentYOffset = m_fPreviousOffset; }
public override bool ProcessMarkup(ProjectLayoutElement zElement, FormattedTextData zData, FormattedTextProcessData zProcessData, Graphics zGraphics) { var arrayComponents = m_sVariable.Split(new char[] { ';' }); if (1 > arrayComponents.Length) { return false; } LineNumber = zProcessData.CurrentLine; m_sImageFile = arrayComponents[0]; var zBmp = DrawItem.LoadImageFromCache(m_sImageFile); if (null == zBmp) { return false; } var fLineHeightPercent = -1f; // SOOOOO much duplication switch (arrayComponents.Length) { case 1: TargetRect = new RectangleF(zProcessData.CurrentX, zProcessData.CurrentY, zBmp.Width, zBmp.Height); break; case 2: float.TryParse(arrayComponents[1], out fLineHeightPercent); TargetRect = new RectangleF(zProcessData.CurrentX, zProcessData.CurrentY, zBmp.Width, zBmp.Height); break; case 3: if (float.TryParse(arrayComponents[1], out m_fXOffset) && float.TryParse(arrayComponents[2], out m_fYOffset)) { TargetRect = new RectangleF(zProcessData.CurrentX, zProcessData.CurrentY, zBmp.Width, zBmp.Height); } break; case 4: float.TryParse(arrayComponents[1], out fLineHeightPercent); if (float.TryParse(arrayComponents[2], out m_fXOffset) && float.TryParse(arrayComponents[3], out m_fYOffset)) { TargetRect = new RectangleF(zProcessData.CurrentX, zProcessData.CurrentY, zBmp.Width, zBmp.Height); } break; case 5: // width and height are absolute (even overlapping drawing) { int nWidth; int nHeight; if (float.TryParse(arrayComponents[1], out m_fXOffset) && float.TryParse(arrayComponents[2], out m_fYOffset) && int.TryParse(arrayComponents[3], out nWidth) && int.TryParse(arrayComponents[4], out nHeight)) { TargetRect = new RectangleF(zProcessData.CurrentX, zProcessData.CurrentY, nWidth, nHeight); } } break; } if (TargetRect == RectangleF.Empty) { return false; } m_fXOffset += zProcessData.CurrentXOffset; m_fYOffset += zProcessData.CurrentYOffset; if (-1f != fLineHeightPercent) { var aspectRatio = TargetRect.Width / TargetRect.Height; var fNewHeight = fLineHeightPercent * (zProcessData.FontHeight == 0f ? 1f : (float)zProcessData.FontHeight); var fNewWidth = fNewHeight * aspectRatio; TargetRect = new RectangleF(zProcessData.CurrentX, zProcessData.CurrentY, fNewWidth, fNewHeight); } // newline eval if (TargetRect.Width + TargetRect.X > zElement.width) { zProcessData.MoveToNextLine(zElement); TargetRect = new RectangleF(0, zProcessData.CurrentY, TargetRect.Width, TargetRect.Height); } // cap off excessively wide images if (TargetRect.Width + TargetRect.X > zElement.width) { TargetRect = new RectangleF(TargetRect.X, TargetRect.Y, zElement.width, TargetRect.Height); } // Center the image on the line based on font height or line height (todo figure out which...) TargetRect = new RectangleF(TargetRect.X, TargetRect.Y + (((float)zProcessData.FontHeight - (float)TargetRect.Height) / 2f), TargetRect.Width, TargetRect.Height); zProcessData.CurrentX += TargetRect.Width; return true; }
public override bool ProcessMarkup(ProjectLayoutElement zElement, FormattedTextData zData, FormattedTextProcessData zProcessData, Graphics zGraphics) { return true; }
/// <summary> /// Processes the markup to determine the markup stack information (font settings, rectangle sizes/settings) /// </summary> /// <param name="zElement"></param> /// <param name="zData"></param> /// <param name="zProcessData"></param> /// <param name="zGraphics"></param> /// <returns>true if this markup is to be further processed</returns> public virtual bool ProcessMarkup(ProjectLayoutElement zElement, FormattedTextData zData, FormattedTextProcessData zProcessData, Graphics zGraphics) { return false; }
public override bool ProcessMarkup(ProjectLayoutElement zElement, FormattedTextData zData, FormattedTextProcessData zProcessData, Graphics zGraphics) { m_zPreviousBrush = zProcessData.FontBrush; zProcessData.FontBrush = new SolidBrush(ProjectLayoutElement.TranslateColorString(m_sVariable)); return false; }