[recipes] Complete the vulgar fraction support



commit d4d23911d0bc208f297541a94f123155402ff49d
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Jun 24 15:57:06 2017 -0400

    Complete the vulgar fraction support
    
    We want to display all the fractions with small denominators (up
    to 10) as fractions. So far, we only did so for the fractions which
    are represented in Unicode. The right way to go about this would
    be to use the OpenType fraction feature, but it is unfortunately
    not supported well enough in our fonts. Therefore, synthesize the
    remaining fractions using superscripts and subscripts, which works
    with most fonts.

 src/gr-number.c |   27 ++++++++++++++++++++-------
 1 files changed, 20 insertions(+), 7 deletions(-)
---
diff --git a/src/gr-number.c b/src/gr-number.c
index 9c6d153..98a71e8 100644
--- a/src/gr-number.c
+++ b/src/gr-number.c
@@ -122,28 +122,41 @@ typedef struct {
         const char *ch;
 } VulgarFraction;
 
+/* a workaround for poor availability of OpenType frak support in our fonts */
 static VulgarFraction fractions[] = {
-        { 1,  4, "¼" },
         { 1,  2, "½" },
-        { 3,  4, "¾" },
-        { 1,  7, "⅐" },
-        { 1,  9, "⅑" },
-        { 1, 10, "⅒" },
         { 1,  3, "⅓" },
         { 2,  3, "⅔" },
+        { 1,  4, "¼" },
+        { 3,  4, "¾" },
         { 1,  5, "⅕" },
         { 2,  5, "⅖" },
         { 3,  5, "⅗" },
         { 4,  5, "⅘" },
         { 1,  6, "⅙" },
         { 5,  6, "⅚" },
+        { 1,  7, "⅐" },
+        { 2,  7, "²⁄₇" },
+        { 3,  7, "³⁄₇" },
+        { 4,  7, "⁴⁄₇" },
+        { 5,  7, "⁵⁄₇" },
+        { 6,  7, "⁶⁄₇" },
         { 1,  8, "⅛" },
         { 3,  8, "⅜" },
         { 5,  8, "⅝" },
-        { 7,  8, "⅞" }
+        { 7,  8, "⅞" },
+        { 1,  9, "⅑" },
+        { 2,  9, "²⁄₉" },
+        { 4,  9, "⁴⁄₉" },
+        { 5,  9, "⁵⁄₉" },
+        { 7,  9, "⁷⁄₉" },
+        { 8,  9, "⁸⁄₉" },
+        { 1, 10, "⅒" },
+        { 3, 10, "³⁄₁₀" },
+        { 7, 10, "⁷⁄₁₀" },
+        { 9, 10, "⁹⁄₁₀" }
 };
 
-/* a workaround for poor availability of OpenType frak support in our fonts */
 static gboolean
 parse_as_vulgar_fraction (GrNumber  *number,
                           char     **input,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]