Example #1
0
 private static void ToLaTeX(this IGrouping<Font, Font> font, StringBuilder stringBuilder, string sampleText)
 {
     stringBuilder.AppendLineWithIndentFormat(0,
                                              @"{0} & \sample{{{1}}}{{{2}}} \\",
                                              font.Key.FaceNames.GetPreferedString(),
                                              font.Key.GetInformationalStrings(InformationalStringId.PostScriptName).GetPreferedString(),
                                              sampleText.EscapseToLaTeX());
 }
Example #2
0
        private static void ToLaTeX(this IGrouping<FontStyle, Font> style, StringBuilder stringBuilder, int indent, string sampleText)
        {
            stringBuilder.AppendWithIndentFormat(0, @"\multirow{{{0}}}{{*}}{{{1}}} & ", style.Count(), style.Key.ToString());

            var fonts = style.GroupBy(t => t).ToArray();

            fonts.First().ToLaTeX(stringBuilder, sampleText);

            foreach (var font in fonts.Skip(1))
            {
                stringBuilder.AppendLineWithIndentFormat(indent, @"\cline{{4-{0}}}", Headers.Length);
                stringBuilder.AppendWithIndent(indent, "& & & ");
                font.ToLaTeX(stringBuilder, sampleText);
            }
        }
Example #3
0
        private static void ToLaTeX(this IGrouping<FontStretch, Font> stretch, StringBuilder stringBuilder, int indent, string sampleText)
        {
            stringBuilder.AppendWithIndentFormat(indent, @"\multirow{{{0}}}{{*}}{{{1}}} & ", stretch.Count(), stretch.Key.GetDisplayString());

            var weights = stretch.GroupBy(t => t.Weight).ToArray();

            weights.First().ToLaTeX(stringBuilder, indent, sampleText);

            foreach (var weight in weights.Skip(1))
            {
                stringBuilder.AppendLineWithIndentFormat(indent, @"\cline{{2-{0}}}", Headers.Length);
                stringBuilder.AppendWithIndent(indent, "& ");
                weight.ToLaTeX(stringBuilder, indent, sampleText);
            }
        }
Example #4
0
        private static void ToLaTeX(this IGrouping<FontWeight, Font> weight, StringBuilder stringBuilder, int indent, string sampleText)
        {
            stringBuilder.AppendWithIndentFormat(0, @"\multirow{{{0}}}{{*}}{{{1}}} & ", weight.Count(), weight.Key.GetDisplayString());

            var styles = weight.GroupBy(t => t.Style).ToArray();

            styles.First().ToLaTeX(stringBuilder, indent, sampleText);

            foreach (var style in styles.Skip(1))
            {
                stringBuilder.AppendLineWithIndentFormat(indent, @"\cline{{3-{0}}}", Headers.Length);
                stringBuilder.AppendWithIndent(indent, "& & ");
                style.ToLaTeX(stringBuilder, indent, sampleText);
            }
        }
Example #5
0
        public static void ToLaTeX(this IEnumerable<Font> fonts, StringBuilder stringBuilder, int indent, string sampleText)
        {
            stringBuilder.AppendLineWithIndentFormat(indent, @"\begin{{tabular}}{{|{0}|}}", string.Join("|", Headers.Select(s => "l")));
            stringBuilder.AppendLineWithIndent(indent + 1, @"\hline");
            stringBuilder.AppendLineWithIndentFormat(indent + 1, @"{0} \\", string.Join(" & ", Headers));
            stringBuilder.AppendLineWithIndent(indent + 1, @"\hline");

            var stretches = from t in fonts
                            orderby t.Weight, t.Stretch
                            group t by t.Stretch;

            foreach (var stretch in stretches)
            {
                stretch.ToLaTeX(stringBuilder, indent + 1, sampleText);
                stringBuilder.AppendLineWithIndent(indent + 1, @"\hline");
            }
            stringBuilder.AppendLineWithIndent(indent, @"\end{tabular}");
        }