示例#1
0
        internal static int ToFontWeight(RPLFormat.FontWeights val)
        {
            switch (val)
            {
            case RPLFormat.FontWeights.Thin:
                return(100);

            case RPLFormat.FontWeights.ExtraLight:
                return(200);

            case RPLFormat.FontWeights.Light:
                return(300);

            case RPLFormat.FontWeights.Normal:
                return(400);

            case RPLFormat.FontWeights.Medium:
                return(500);

            case RPLFormat.FontWeights.SemiBold:
                return(600);

            case RPLFormat.FontWeights.Bold:
                return(700);

            case RPLFormat.FontWeights.ExtraBold:
                return(800);

            case RPLFormat.FontWeights.Heavy:
                return(900);

            default:
                return(400);
            }
        }
示例#2
0
        public static string GetValue(RPLFormat.FontWeights val)
        {
            switch (val)
            {
            case RPLFormat.FontWeights.Normal:
                return("400");

            case RPLFormat.FontWeights.Thin:
                return("100");

            case RPLFormat.FontWeights.ExtraLight:
                return("200");

            case RPLFormat.FontWeights.Light:
                return("300");

            case RPLFormat.FontWeights.Medium:
                return("500");

            case RPLFormat.FontWeights.SemiBold:
                return("600");

            case RPLFormat.FontWeights.Bold:
                return("700");

            case RPLFormat.FontWeights.ExtraBold:
                return("800");

            case RPLFormat.FontWeights.Heavy:
                return("900");

            default:
                return(null);
            }
        }
示例#3
0
 private bool IsBold(RPLFormat.FontWeights fontWeight)
 {
     if (fontWeight != RPLFormat.FontWeights.SemiBold && fontWeight != RPLFormat.FontWeights.Bold && fontWeight != RPLFormat.FontWeights.ExtraBold && fontWeight != RPLFormat.FontWeights.Heavy)
     {
         return(false);
     }
     return(true);
 }
示例#4
0
 internal static bool IsBold(RPLFormat.FontWeights fontWeight)
 {
     if (fontWeight - 5 <= RPLFormat.FontWeights.Light)
     {
         return(true);
     }
     return(false);
 }
 public static bool IsWeightBold(RPLFormat.FontWeights weight)
 {
     if (weight != RPLFormat.FontWeights.SemiBold && weight != RPLFormat.FontWeights.Bold && weight != RPLFormat.FontWeights.ExtraBold && weight != RPLFormat.FontWeights.Heavy)
     {
         return(false);
     }
     return(true);
 }
 internal static bool IsWeightBold(RPLFormat.FontWeights weight)
 {
     if (weight == RPLFormat.FontWeights.SemiBold || weight == RPLFormat.FontWeights.Bold || weight == RPLFormat.FontWeights.ExtraBold || weight == RPLFormat.FontWeights.Heavy)
     {
         return(true);
     }
     return(false);
 }
示例#7
0
        public static bool IsBold(RPLFormat.FontWeights fontWeight)
        {
            switch (fontWeight)
            {
            case RPLFormat.FontWeights.SemiBold:
            case RPLFormat.FontWeights.Bold:
            case RPLFormat.FontWeights.ExtraBold:
            case RPLFormat.FontWeights.Heavy:
                return(true);

            default:
                return(false);
            }
        }
示例#8
0
 public void RenderFontWeight(RPLFormat.FontWeights fontWeights, RPLFormat.Directions dir)
 {
     if ((int)fontWeights >= 5)
     {
         this.m_charFormat.AddSprm(2101, 1, null);
         if (dir == RPLFormat.Directions.RTL)
         {
             this.m_charFormat.AddSprm(2140, 1, null);
         }
     }
     else
     {
         this.m_charFormat.AddSprm(2101, 0, null);
         if (dir == RPLFormat.Directions.RTL)
         {
             this.m_charFormat.AddSprm(2140, 0, null);
         }
     }
 }
示例#9
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());
        }
示例#10
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;
            }
        }
 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);
 }
 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 RenderFontWeight(RPLFormat.FontWeights fontWeights, RPLFormat.Directions dir)
 {
     this.GetCurrentTextStyle().SetBold((int)fontWeights >= 5, dir == RPLFormat.Directions.RTL);
 }