Ejemplo n.º 1
0
 private bool IsItalic(RPLFormat.FontStyles fontStyle)
 {
     if (fontStyle == RPLFormat.FontStyles.Italic)
     {
         return(true);
     }
     return(false);
 }
Ejemplo n.º 2
0
        public static string GetValue(RPLFormat.FontStyles val)
        {
            switch (val)
            {
            case RPLFormat.FontStyles.Normal:
                return("normal");

            case RPLFormat.FontStyles.Italic:
                return("italic");

            default:
                return(null);
            }
        }
Ejemplo n.º 3
0
 public void RenderFontStyle(RPLFormat.FontStyles value, RPLFormat.Directions dir)
 {
     if (value == RPLFormat.FontStyles.Italic)
     {
         this.m_charFormat.AddSprm(2102, 1, null);
         if (dir == RPLFormat.Directions.RTL)
         {
             this.m_charFormat.AddSprm(2141, 1, null);
         }
     }
     else
     {
         this.m_charFormat.AddSprm(2102, 0, null);
         if (dir == RPLFormat.Directions.RTL)
         {
             this.m_charFormat.AddSprm(2141, 0, null);
         }
     }
 }
Ejemplo n.º 4
0
        public static GDIFont GetOrCreateFont(Dictionary <string, GDIFont> gdiFonts, string fontFamily, float fontSize, RPLFormat.FontWeights fontWeight, RPLFormat.FontStyles fontStyle, RPLFormat.TextDecorations textDecoration)
        {
            string  key     = GDIFont.GetKey(fontFamily, fontSize, fontWeight, fontStyle, textDecoration);
            GDIFont gDIFont = default(GDIFont);

            if (gdiFonts.TryGetValue(key, out gDIFont))
            {
                return(gDIFont);
            }
            bool flag        = SharedRenderer.IsWeightBold(fontWeight);
            bool flag2       = fontStyle == RPLFormat.FontStyles.Italic;
            bool underLine   = false;
            bool lineThrough = false;

            switch (textDecoration)
            {
            case RPLFormat.TextDecorations.Underline:
                underLine = true;
                break;

            case RPLFormat.TextDecorations.LineThrough:
                lineThrough = true;
                break;
            }
            Font font = null;

            try
            {
                font    = FontCache.CreateGdiPlusFont(fontFamily, fontSize, ref flag, ref flag2, lineThrough, underLine);
                gDIFont = new GDIFont(key, font, fontSize);
                gdiFonts.Add(key, gDIFont);
                return(gDIFont);
            }
            catch
            {
                if (font != null && !gdiFonts.ContainsKey(key))
                {
                    font.Dispose();
                    font = null;
                }
                throw;
            }
        }
Ejemplo n.º 5
0
        private static string GetKey(string fontFamily, float fontSize, RPLFormat.FontWeights fontWeight, RPLFormat.FontStyles fontStyle, RPLFormat.TextDecorations textDecoration)
        {
            StringBuilder stringBuilder = new StringBuilder("FO");

            stringBuilder.Append(fontFamily);
            stringBuilder.Append(fontSize.ToString(CultureInfo.InvariantCulture));
            if (SharedRenderer.IsWeightBold(fontWeight))
            {
                stringBuilder.Append('b');
            }
            else
            {
                stringBuilder.Append('n');
            }
            if (fontStyle == RPLFormat.FontStyles.Italic)
            {
                stringBuilder.Append('i');
            }
            else
            {
                stringBuilder.Append('n');
            }
            switch (textDecoration)
            {
            case RPLFormat.TextDecorations.Underline:
                stringBuilder.Append('u');
                break;

            case RPLFormat.TextDecorations.LineThrough:
                stringBuilder.Append('s');
                break;

            default:
                stringBuilder.Append('n');
                break;
            }
            return(stringBuilder.ToString());
        }
 public static void GetFontStyleInformation(RPLElementProps elementProperties, out RPLFormat.FontStyles fontStyle, out RPLFormat.FontWeights fontWeight, out RPLFormat.TextDecorations textDecoration, out float fontSize, out string fontFamily, ref bool fontStyleFromInstance)
 {
     fontSize       = (float)new RPLReportSize(SharedRenderer.GetStylePropertyValueString(elementProperties, (byte)21, ref fontStyleFromInstance)).ToPoints();
     fontStyle      = (RPLFormat.FontStyles)SharedRenderer.GetStylePropertyValueObject(elementProperties, (byte)19, ref fontStyleFromInstance);
     fontWeight     = (RPLFormat.FontWeights)SharedRenderer.GetStylePropertyValueObject(elementProperties, (byte)22, ref fontStyleFromInstance);
     textDecoration = (RPLFormat.TextDecorations)SharedRenderer.GetStylePropertyValueObject(elementProperties, (byte)24, ref fontStyleFromInstance);
     fontFamily     = SharedRenderer.GetStylePropertyValueString(elementProperties, (byte)20, ref fontStyleFromInstance);
 }
Ejemplo n.º 7
0
 internal static void GetFontStyleInformation(RPLElementProps elementProperties, out RPLFormat.FontStyles fontStyle, out RPLFormat.FontWeights fontWeight, out RPLFormat.TextDecorations textDecoration, out float fontSize, out string fontFamily, ref bool fontStyleFromInstance)
 {
     fontSize       = (float)new RPLReportSize(GetStylePropertyValueString(elementProperties, 21, ref fontStyleFromInstance)).ToPoints();
     fontStyle      = (RPLFormat.FontStyles)GetStylePropertyValueObject(elementProperties, 19, ref fontStyleFromInstance);
     fontWeight     = (RPLFormat.FontWeights)GetStylePropertyValueObject(elementProperties, 22, ref fontStyleFromInstance);
     textDecoration = (RPLFormat.TextDecorations)GetStylePropertyValueObject(elementProperties, 24, ref fontStyleFromInstance);
     fontFamily     = GetStylePropertyValueString(elementProperties, 20, ref fontStyleFromInstance);
 }
 public void RenderFontStyle(RPLFormat.FontStyles value, RPLFormat.Directions dir)
 {
     this.GetCurrentTextStyle().SetItalic(value == RPLFormat.FontStyles.Italic, dir == RPLFormat.Directions.RTL);
 }