[gtk+] gtk-demo: Expand font features demo



commit 9de3b24c205f1c647292a490f92f21a776b931a4
Author: Matthias Clasen <mclasen redhat com>
Date:   Mon Jan 25 00:40:49 2016 -0500

    gtk-demo: Expand font features demo
    
    Add more features to the list, allow selecting script/language
    from the set that is supported by the font, indicate which
    features are present in the font for the selected script/language,
    and expand the default specimen to cover latin, cyrillic and
    greek.

 demos/gtk-demo/font-features.ui | 1323 ++++++++++++++++++++++++++++++---------
 demos/gtk-demo/font_features.c  |  402 +++++++++++--
 2 files changed, 1373 insertions(+), 352 deletions(-)
---
diff --git a/demos/gtk-demo/font-features.ui b/demos/gtk-demo/font-features.ui
index 5742b57..a923913 100644
--- a/demos/gtk-demo/font-features.ui
+++ b/demos/gtk-demo/font-features.ui
@@ -28,7 +28,7 @@
       </object>
     </child>
     <child>
-      <object class="GtkBox" id="box1">
+      <object class="GtkBox">
         <property name="visible">1</property>
         <child>
           <object class="GtkScrolledWindow" id="scrolledwindow1">
@@ -39,7 +39,7 @@
               <object class="GtkViewport" id="viewport1">
                 <property name="visible">1</property>
                 <child>
-                  <object class="GtkBox" id="box2">
+                  <object class="GtkBox">
                     <property name="visible">1</property>
                     <property name="margin">10</property>
                     <property name="orientation">vertical</property>
@@ -50,29 +50,50 @@
                         <property name="can_focus">1</property>
                         <property name="receives_default">1</property>
                         <property name="font">Sans 12</property>
-                        <signal name="font-set" handler="update" swapped="no"/>
+                        <signal name="font-set" handler="font_changed" swapped="no"/>
                       </object>
                     </child>
                     <child>
-                      <object class="GtkExpander" id="expander1">
+                      <object class="GtkComboBox" id="script_lang">
                         <property name="visible">1</property>
                         <property name="can_focus">1</property>
+                        <signal name="changed" handler="script_changed" swapped="no"/>
                         <child>
-                          <object class="GtkBox" id="box13">
+                          <object class="GtkCellRendererText"/>
+                          <attributes>
+                            <attribute name="text">0</attribute>
+                          </attributes>
+                        </child>
+                      </object>
+                    </child>
+                    <child>
+                      <object class="GtkExpander">
+                        <property name="visible">1</property>
+                        <property name="can_focus">1</property>
+                        <child>
+                          <object class="GtkBox">
                             <property name="visible">1</property>
-                            <property name="margin_start">20</property>
-                            <property name="margin_end">20</property>
+                            <property name="margin_start">10</property>
+                            <property name="margin_end">10</property>
                             <property name="margin_top">10</property>
                             <property name="orientation">vertical</property>
                             <child>
-                              <object class="GtkBox" id="box14">
+                              <object class="GtkBox">
                                 <property name="visible">1</property>
                                 <child>
+                                  <object class="GtkImage" id="kern_pres">
+                                    <property name="visible">1</property>
+                                    <property name="icon-name">object-select-symbolic</property>
+                                    <property name="icon-size">1</property>
+                                  </object>
+                                </child>
+                                <child>
                                   <object class="GtkCheckButton" id="kern_dflt">
                                     <property name="visible">1</property>
                                     <property name="can_focus">1</property>
                                     <property name="draw_indicator">1</property>
-                                    <signal name="notify::active" handler="update" swapped="no"/>
+                                    <property name="valign">baseline</property>
+                                    <signal name="notify::active" handler="update_display" swapped="no"/>
                                   </object>
                                 </child>
                                 <child>
@@ -81,185 +102,200 @@
                                     <property name="visible">1</property>
                                     <property name="can_focus">1</property>
                                     <property name="draw_indicator">1</property>
-                                    <signal name="notify::active" handler="update" swapped="no"/>
+                                    <property name="valign">baseline</property>
+                                    <signal name="notify::active" handler="update_display" swapped="no"/>
                                     <property name="sensitive" bind-source="kern_dflt" 
bind-property="active" bind-flags="sync-create|bidirectional"/>
                                   </object>
-                                  <packing>
-                                    <property name="position">1</property>
-                                  </packing>
                                 </child>
                               </object>
                             </child>
                           </object>
                         </child>
                         <child type="label">
-                          <object class="GtkLabel" id="label2">
+                          <object class="GtkLabel">
                             <property name="visible">1</property>
                             <property name="label" translatable="yes">Kerning</property>
                           </object>
                         </child>
                       </object>
-                      <packing>
-                        <property name="position">1</property>
-                      </packing>
                     </child>
                     <child>
-                      <object class="GtkExpander" id="expander2">
+                      <object class="GtkExpander">
                         <property name="visible">1</property>
                         <property name="can_focus">1</property>
                         <child>
-                          <object class="GtkBox" id="box3">
+                          <object class="GtkBox">
                             <property name="visible">1</property>
-                            <property name="margin_start">20</property>
-                            <property name="margin_end">20</property>
+                            <property name="margin_start">10</property>
+                            <property name="margin_end">10</property>
                             <property name="margin_top">10</property>
                             <property name="orientation">vertical</property>
                             <child>
-                              <object class="GtkBox" id="box15">
+                              <object class="GtkBox">
                                 <property name="visible">1</property>
                                 <child>
+                                  <object class="GtkImage" id="liga_pres">
+                                    <property name="visible">1</property>
+                                    <property name="icon-name">object-select-symbolic</property>
+                                    <property name="icon-size">1</property>
+                                  </object>
+                                </child>
+                                <child>
                                   <object class="GtkCheckButton" id="liga_dflt">
                                     <property name="visible">1</property>
                                     <property name="can_focus">1</property>
                                     <property name="draw_indicator">1</property>
-                                    <signal name="notify::active" handler="update" swapped="no"/>
+                                    <property name="valign">baseline</property>
+                                    <signal name="notify::active" handler="update_display" swapped="no"/>
                                   </object>
                                 </child>
                                 <child>
                                   <object class="GtkCheckButton" id="liga">
-                                    <property name="label" translatable="yes">Common</property>
+                                    <property name="label" translatable="yes">Common Ligatures</property>
                                     <property name="visible">1</property>
                                     <property name="can_focus">1</property>
                                     <property name="draw_indicator">1</property>
-                                    <signal name="notify::active" handler="update" swapped="no"/>
+                                    <property name="valign">baseline</property>
+                                    <signal name="notify::active" handler="update_display" swapped="no"/>
                                     <property name="sensitive" bind-source="liga_dflt" 
bind-property="active" bind-flags="sync-create|bidirectional"/>
                                   </object>
-                                  <packing>
-                                    <property name="position">1</property>
-                                  </packing>
                                 </child>
                               </object>
                             </child>
                             <child>
-                              <object class="GtkBox" id="box16">
+                              <object class="GtkBox">
                                 <property name="visible">1</property>
                                 <child>
+                                  <object class="GtkImage" id="dlig_pres">
+                                    <property name="visible">1</property>
+                                    <property name="icon-name">object-select-symbolic</property>
+                                    <property name="icon-size">1</property>
+                                  </object>
+                                </child>
+                                <child>
                                   <object class="GtkCheckButton" id="dlig_dflt">
                                     <property name="visible">1</property>
                                     <property name="can_focus">1</property>
                                     <property name="draw_indicator">1</property>
-                                    <signal name="notify::active" handler="update" swapped="no"/>
+                                    <property name="valign">baseline</property>
+                                    <signal name="notify::active" handler="update_display" swapped="no"/>
                                   </object>
                                 </child>
                                 <child>
                                   <object class="GtkCheckButton" id="dlig">
-                                    <property name="label" translatable="yes">Discretionary</property>
+                                    <property name="label" translatable="yes">Discretionary 
Ligatures</property>
                                     <property name="visible">1</property>
                                     <property name="can_focus">1</property>
                                     <property name="draw_indicator">1</property>
-                                    <signal name="notify::active" handler="update" swapped="no"/>
+                                    <property name="valign">baseline</property>
+                                    <signal name="notify::active" handler="update_display" swapped="no"/>
                                     <property name="sensitive" bind-source="dlig_dflt" 
bind-property="active" bind-flags="sync-create|bidirectional"/>
                                   </object>
-                                  <packing>
-                                    <property name="position">1</property>
-                                  </packing>
                                 </child>
                               </object>
-                              <packing>
-                                <property name="position">1</property>
-                              </packing>
                             </child>
                             <child>
-                              <object class="GtkBox" id="box17">
+                              <object class="GtkBox">
                                 <property name="visible">1</property>
                                 <child>
+                                  <object class="GtkImage" id="hlig_pres">
+                                    <property name="visible">1</property>
+                                    <property name="icon-name">object-select-symbolic</property>
+                                    <property name="icon-size">1</property>
+                                  </object>
+                                </child>
+                                <child>
                                   <object class="GtkCheckButton" id="hlig_dflt">
                                     <property name="visible">1</property>
                                     <property name="can_focus">1</property>
                                     <property name="draw_indicator">1</property>
-                                    <signal name="notify::active" handler="update" swapped="no"/>
+                                    <property name="valign">baseline</property>
+                                    <signal name="notify::active" handler="update_display" swapped="no"/>
                                   </object>
                                 </child>
                                 <child>
                                   <object class="GtkCheckButton" id="hlig">
-                                    <property name="label" translatable="yes">Historical</property>
+                                    <property name="label" translatable="yes">Historical Ligatures</property>
                                     <property name="visible">1</property>
                                     <property name="can_focus">1</property>
                                     <property name="draw_indicator">1</property>
-                                    <signal name="notify::active" handler="update" swapped="no"/>
+                                    <property name="valign">baseline</property>
+                                    <signal name="notify::active" handler="update_display" swapped="no"/>
                                     <property name="sensitive" bind-source="hlig_dflt" 
bind-property="active" bind-flags="sync-create|bidirectional"/>
                                   </object>
-                                  <packing>
-                                    <property name="position">1</property>
-                                  </packing>
                                 </child>
                               </object>
-                              <packing>
-                                <property name="position">2</property>
-                              </packing>
                             </child>
                             <child>
-                              <object class="GtkBox" id="box18">
+                              <object class="GtkBox">
                                 <property name="visible">1</property>
                                 <child>
+                                  <object class="GtkImage" id="clig_pres">
+                                    <property name="visible">1</property>
+                                    <property name="icon-name">object-select-symbolic</property>
+                                    <property name="icon-size">1</property>
+                                  </object>
+                                </child>
+                                <child>
                                   <object class="GtkCheckButton" id="clig_dflt">
                                     <property name="visible">1</property>
                                     <property name="can_focus">1</property>
                                     <property name="draw_indicator">1</property>
-                                    <signal name="notify::active" handler="update" swapped="no"/>
+                                    <property name="valign">baseline</property>
+                                    <signal name="notify::active" handler="update_display" swapped="no"/>
                                   </object>
                                 </child>
                                 <child>
                                   <object class="GtkCheckButton" id="clig">
-                                    <property name="label" translatable="yes">Contextual</property>
+                                    <property name="label" translatable="yes">Contextual Ligatures</property>
                                     <property name="visible">1</property>
                                     <property name="can_focus">1</property>
                                     <property name="draw_indicator">1</property>
-                                    <signal name="notify::active" handler="update" swapped="no"/>
+                                    <property name="valign">baseline</property>
+                                    <signal name="notify::active" handler="update_display" swapped="no"/>
                                     <property name="sensitive" bind-source="clig_dflt" 
bind-property="active" bind-flags="sync-create|bidirectional"/>
                                   </object>
-                                  <packing>
-                                    <property name="position">1</property>
-                                  </packing>
                                 </child>
                               </object>
-                              <packing>
-                                <property name="position">3</property>
-                              </packing>
                             </child>
                           </object>
                         </child>
                         <child type="label">
-                          <object class="GtkLabel" id="label3">
+                          <object class="GtkLabel">
                             <property name="visible">1</property>
                             <property name="label" translatable="yes">Ligatures</property>
                           </object>
                         </child>
                       </object>
-                      <packing>
-                        <property name="position">2</property>
-                      </packing>
                     </child>
                     <child>
-                      <object class="GtkExpander" id="expander3">
+                      <object class="GtkExpander">
                         <property name="visible">1</property>
                         <property name="can_focus">1</property>
                         <child>
-                          <object class="GtkBox" id="box4">
+                          <object class="GtkBox">
                             <property name="visible">1</property>
-                            <property name="margin_start">20</property>
-                            <property name="margin_end">20</property>
+                            <property name="margin_start">10</property>
+                            <property name="margin_end">10</property>
                             <property name="margin_top">10</property>
                             <property name="orientation">vertical</property>
                             <child>
-                              <object class="GtkBox" id="box19">
+                              <object class="GtkBox">
                                 <property name="visible">1</property>
                                 <child>
+                                  <object class="GtkImage" id="smcp_pres">
+                                    <property name="visible">1</property>
+                                    <property name="icon-name">object-select-symbolic</property>
+                                    <property name="icon-size">1</property>
+                                  </object>
+                                </child>
+                                <child>
                                   <object class="GtkCheckButton" id="smcp_dflt">
                                     <property name="visible">1</property>
                                     <property name="can_focus">1</property>
                                     <property name="draw_indicator">1</property>
-                                    <signal name="notify::active" handler="update" swapped="no"/>
+                                    <property name="valign">baseline</property>
+                                    <signal name="notify::active" handler="update_display" swapped="no"/>
                                   </object>
                                 </child>
                                 <child>
@@ -268,24 +304,30 @@
                                     <property name="visible">1</property>
                                     <property name="can_focus">1</property>
                                     <property name="draw_indicator">1</property>
-                                    <signal name="notify::active" handler="update" swapped="no"/>
+                                    <signal name="notify::active" handler="update_display" swapped="no"/>
+                                    <property name="valign">baseline</property>
                                     <property name="sensitive" bind-source="smcp_dflt" 
bind-property="active" bind-flags="sync-create|bidirectional"/>
                                   </object>
-                                  <packing>
-                                    <property name="position">1</property>
-                                  </packing>
                                 </child>
                               </object>
                             </child>
                             <child>
-                              <object class="GtkBox" id="box20">
+                              <object class="GtkBox">
                                 <property name="visible">1</property>
                                 <child>
+                                  <object class="GtkImage" id="c2sc_pres">
+                                    <property name="visible">1</property>
+                                    <property name="icon-name">object-select-symbolic</property>
+                                    <property name="icon-size">1</property>
+                                  </object>
+                                </child>
+                                <child>
                                   <object class="GtkCheckButton" id="c2sc_dflt">
                                     <property name="visible">1</property>
                                     <property name="can_focus">1</property>
                                     <property name="draw_indicator">1</property>
-                                    <signal name="notify::active" handler="update" swapped="no"/>
+                                    <property name="valign">baseline</property>
+                                    <signal name="notify::active" handler="update_display" swapped="no"/>
                                   </object>
                                 </child>
                                 <child>
@@ -294,237 +336,490 @@
                                     <property name="visible">1</property>
                                     <property name="can_focus">1</property>
                                     <property name="draw_indicator">1</property>
-                                    <signal name="notify::active" handler="update" swapped="no"/>
+                                    <property name="valign">baseline</property>
+                                    <signal name="notify::active" handler="update_display" swapped="no"/>
                                     <property name="sensitive" bind-source="c2sc_dflt" 
bind-property="active" bind-flags="sync-create|bidirectional"/>
                                   </object>
-                                  <packing>
-                                    <property name="position">1</property>
-                                  </packing>
                                 </child>
                               </object>
-                              <packing>
-                                <property name="position">1</property>
-                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkBox">
+                                <property name="visible">1</property>
+                                <child>
+                                  <object class="GtkImage" id="pcap_pres">
+                                    <property name="visible">1</property>
+                                    <property name="icon-name">object-select-symbolic</property>
+                                    <property name="icon-size">1</property>
+                                  </object>
+                                </child>
+                                <child>
+                                  <object class="GtkCheckButton" id="pcap_dflt">
+                                    <property name="visible">1</property>
+                                    <property name="can_focus">1</property>
+                                    <property name="draw_indicator">1</property>
+                                    <property name="valign">baseline</property>
+                                    <signal name="notify::active" handler="update_display" swapped="no"/>
+                                  </object>
+                                </child>
+                                <child>
+                                  <object class="GtkCheckButton" id="pcap">
+                                    <property name="label" translatable="yes">Petite Caps</property>
+                                    <property name="visible">1</property>
+                                    <property name="can_focus">1</property>
+                                    <property name="draw_indicator">1</property>
+                                    <property name="valign">baseline</property>
+                                    <signal name="notify::active" handler="update_display" swapped="no"/>
+                                    <property name="sensitive" bind-source="pcap_dflt" 
bind-property="active" bind-flags="sync-create|bidirectional"/>
+                                  </object>
+                                </child>
+                              </object>
+                            </child>
+                            <child>
+                              <object class="GtkBox">
+                                <property name="visible">1</property>
+                                <child>
+                                  <object class="GtkImage" id="c2pc_pres">
+                                    <property name="visible">1</property>
+                                    <property name="icon-name">object-select-symbolic</property>
+                                    <property name="icon-size">1</property>
+                                  </object>
+                                </child>
+                                <child>
+                                  <object class="GtkCheckButton" id="c2pc_dflt">
+                                    <property name="visible">1</property>
+                                    <property name="can_focus">1</property>
+                                    <property name="draw_indicator">1</property>
+                                    <property name="valign">baseline</property>
+                                    <signal name="notify::active" handler="update_display" swapped="no"/>
+                                  </object>
+                                </child>
+                                <child>
+                                  <object class="GtkCheckButton" id="c2pc">
+                                    <property name="label" translatable="yes">Caps to Petite Caps</property>
+                                    <property name="visible">1</property>
+                                    <property name="can_focus">1</property>
+                                    <property name="draw_indicator">1</property>
+                                    <property name="valign">baseline</property>
+                                    <signal name="notify::active" handler="update_display" swapped="no"/>
+                                    <property name="sensitive" bind-source="c2pc_dflt" 
bind-property="active" bind-flags="sync-create|bidirectional"/>
+                                  </object>
+                                </child>
+                              </object>
+                            </child>
+                            <child>
+                              <object class="GtkBox">
+                                <property name="visible">1</property>
+                                <child>
+                                  <object class="GtkImage" id="unic_pres">
+                                    <property name="visible">1</property>
+                                    <property name="icon-name">object-select-symbolic</property>
+                                    <property name="icon-size">1</property>
+                                  </object>
+                                </child>
+                                <child>
+                                  <object class="GtkCheckButton" id="unic_dflt">
+                                    <property name="visible">1</property>
+                                    <property name="can_focus">1</property>
+                                    <property name="draw_indicator">1</property>
+                                    <property name="valign">baseline</property>
+                                    <signal name="notify::active" handler="update_display" swapped="no"/>
+                                  </object>
+                                </child>
+                                <child>
+                                  <object class="GtkCheckButton" id="unic">
+                                    <property name="label" translatable="yes">Unicase</property>
+                                    <property name="visible">1</property>
+                                    <property name="can_focus">1</property>
+                                    <property name="draw_indicator">1</property>
+                                    <property name="valign">baseline</property>
+                                    <signal name="notify::active" handler="update_display" swapped="no"/>
+                                    <property name="sensitive" bind-source="unic_dflt" 
bind-property="active" bind-flags="sync-create|bidirectional"/>
+                                  </object>
+                                </child>
+                              </object>
+                            </child>
+                            <child>
+                              <object class="GtkBox">
+                                <property name="visible">1</property>
+                                <child>
+                                  <object class="GtkImage" id="cpsp_pres">
+                                    <property name="visible">1</property>
+                                    <property name="icon-name">object-select-symbolic</property>
+                                    <property name="icon-size">1</property>
+                                  </object>
+                                </child>
+                                <child>
+                                  <object class="GtkCheckButton" id="cpsp_dflt">
+                                    <property name="visible">1</property>
+                                    <property name="can_focus">1</property>
+                                    <property name="draw_indicator">1</property>
+                                    <property name="valign">baseline</property>
+                                    <signal name="notify::active" handler="update_display" swapped="no"/>
+                                  </object>
+                                </child>
+                                <child>
+                                  <object class="GtkCheckButton" id="cpsp">
+                                    <property name="label" translatable="yes">Capital Spacing</property>
+                                    <property name="visible">1</property>
+                                    <property name="can_focus">1</property>
+                                    <property name="draw_indicator">1</property>
+                                    <property name="valign">baseline</property>
+                                    <signal name="notify::active" handler="update_display" swapped="no"/>
+                                    <property name="sensitive" bind-source="cpsp_dflt" 
bind-property="active" bind-flags="sync-create|bidirectional"/>
+                                  </object>
+                                </child>
+                              </object>
+                            </child>
+                            <child>
+                              <object class="GtkBox">
+                                <property name="visible">1</property>
+                                <child>
+                                  <object class="GtkImage" id="case_pres">
+                                    <property name="visible">1</property>
+                                    <property name="icon-name">object-select-symbolic</property>
+                                    <property name="icon-size">1</property>
+                                  </object>
+                                </child>
+                                <child>
+                                  <object class="GtkCheckButton" id="case_dflt">
+                                    <property name="visible">1</property>
+                                    <property name="can_focus">1</property>
+                                    <property name="draw_indicator">1</property>
+                                    <property name="valign">baseline</property>
+                                    <signal name="notify::active" handler="update_display" swapped="no"/>
+                                  </object>
+                                </child>
+                                <child>
+                                  <object class="GtkCheckButton" id="case">
+                                    <property name="label" translatable="yes">Case-sensitive Forms</property>
+                                    <property name="visible">1</property>
+                                    <property name="can_focus">1</property>
+                                    <property name="draw_indicator">1</property>
+                                    <property name="valign">baseline</property>
+                                    <signal name="notify::active" handler="update_display" swapped="no"/>
+                                    <property name="sensitive" bind-source="case_dflt" 
bind-property="active" bind-flags="sync-create|bidirectional"/>
+                                  </object>
+                                </child>
+                              </object>
                             </child>
                           </object>
                         </child>
                         <child type="label">
-                          <object class="GtkLabel" id="label4">
+                          <object class="GtkLabel">
                             <property name="visible">1</property>
                             <property name="label" translatable="yes">Letter Case</property>
                           </object>
                         </child>
                       </object>
-                      <packing>
-                        <property name="position">3</property>
-                      </packing>
                     </child>
                     <child>
-                      <object class="GtkExpander" id="expander7">
+                      <object class="GtkExpander">
                         <property name="visible">1</property>
                         <property name="can_focus">1</property>
                         <child>
-                          <object class="GtkBox" id="box5">
+                          <object class="GtkBox">
                             <property name="visible">1</property>
-                            <property name="margin_start">20</property>
-                            <property name="margin_end">20</property>
+                            <property name="margin_start">10</property>
+                            <property name="margin_end">10</property>
                             <property name="margin_top">10</property>
                             <property name="orientation">vertical</property>
                             <child>
-                              <object class="GtkRadioButton" id="numcasedefault">
-                                <property name="label" translatable="yes">Default</property>
+                              <object class="GtkBox">
                                 <property name="visible">1</property>
-                                <property name="can_focus">1</property>
-                                <property name="active">1</property>
-                                <property name="draw_indicator">1</property>
-                                <signal name="notify::active" handler="update" swapped="no"/>
+                                <child>
+                                  <object class="GtkImage" id="numcasedefault_pres">
+                                    <property name="visible">1</property>
+                                    <property name="opacity">0</property>
+                                    <property name="icon-name">object-select-symbolic</property>
+                                    <property name="icon-size">1</property>
+                                  </object>
+                                </child>
+                                <child>
+                                  <object class="GtkRadioButton" id="numcasedefault">
+                                    <property name="label" translatable="yes">Default</property>
+                                    <property name="visible">1</property>
+                                    <property name="can_focus">1</property>
+                                    <property name="active">1</property>
+                                    <property name="draw_indicator">1</property>
+                                    <property name="valign">baseline</property>
+                                    <signal name="notify::active" handler="update_display" swapped="no"/>
+                                  </object>
+                                </child>
                               </object>
                             </child>
                             <child>
-                              <object class="GtkRadioButton" id="lnum">
-                                <property name="label" translatable="yes">Lining</property>
+                              <object class="GtkBox">
                                 <property name="visible">1</property>
-                                <property name="can_focus">1</property>
-                                <property name="active">1</property>
-                                <property name="draw_indicator">1</property>
-                                <property name="group">numcasedefault</property>
-                                <signal name="notify::active" handler="update" swapped="no"/>
+                                <child>
+                                  <object class="GtkImage" id="lnum_pres">
+                                    <property name="visible">1</property>
+                                    <property name="icon-name">object-select-symbolic</property>
+                                    <property name="icon-size">1</property>
+                                  </object>
+                                </child>
+                                <child>
+                                  <object class="GtkRadioButton" id="lnum">
+                                    <property name="label" translatable="yes">Lining</property>
+                                    <property name="visible">1</property>
+                                    <property name="can_focus">1</property>
+                                    <property name="active">1</property>
+                                    <property name="draw_indicator">1</property>
+                                    <property name="valign">baseline</property>
+                                    <property name="group">numcasedefault</property>
+                                    <signal name="notify::active" handler="update_display" swapped="no"/>
+                                  </object>
+                                </child>
                               </object>
-                              <packing>
-                                <property name="position">1</property>
-                              </packing>
                             </child>
                             <child>
-                              <object class="GtkRadioButton" id="onum">
-                                <property name="label" translatable="yes">Old-Style</property>
+                              <object class="GtkBox">
                                 <property name="visible">1</property>
-                                <property name="can_focus">1</property>
-                                <property name="active">1</property>
-                                <property name="draw_indicator">1</property>
-                                <property name="group">numcasedefault</property>
-                                <signal name="notify::active" handler="update" swapped="no"/>
+                                <child>
+                                  <object class="GtkImage" id="onum_pres">
+                                    <property name="visible">1</property>
+                                    <property name="icon-name">object-select-symbolic</property>
+                                    <property name="icon-size">1</property>
+                                  </object>
+                                </child>
+                                <child>
+                                  <object class="GtkRadioButton" id="onum">
+                                    <property name="label" translatable="yes">Old-Style</property>
+                                    <property name="visible">1</property>
+                                    <property name="can_focus">1</property>
+                                    <property name="active">1</property>
+                                    <property name="valign">baseline</property>
+                                    <property name="draw_indicator">1</property>
+                                    <property name="group">numcasedefault</property>
+                                    <signal name="notify::active" handler="update_display" swapped="no"/>
+                                  </object>
+                                </child>
                               </object>
-                              <packing>
-                                <property name="position">2</property>
-                              </packing>
                             </child>
                           </object>
                         </child>
                         <child type="label">
-                          <object class="GtkLabel" id="label8">
+                          <object class="GtkLabel">
                             <property name="visible">1</property>
                             <property name="label" translatable="yes">Number Case</property>
                           </object>
                         </child>
                       </object>
-                      <packing>
-                        <property name="position">4</property>
-                      </packing>
                     </child>
                     <child>
-                      <object class="GtkExpander" id="expander8">
+                      <object class="GtkExpander">
                         <property name="visible">1</property>
                         <property name="can_focus">1</property>
                         <child>
-                          <object class="GtkBox" id="box6">
+                          <object class="GtkBox">
                             <property name="visible">1</property>
-                            <property name="margin_start">20</property>
-                            <property name="margin_end">20</property>
+                            <property name="margin_start">10</property>
+                            <property name="margin_end">10</property>
                             <property name="margin_top">10</property>
                             <property name="orientation">vertical</property>
                             <child>
-                              <object class="GtkRadioButton" id="numspacedefault">
-                                <property name="label" translatable="yes">Default</property>
+                              <object class="GtkBox">
                                 <property name="visible">1</property>
-                                <property name="can_focus">1</property>
-                                <property name="active">1</property>
-                                <property name="draw_indicator">1</property>
-                                <signal name="notify::active" handler="update" swapped="no"/>
+                                <child>
+                                  <object class="GtkImage" id="numspacedefault_pres">
+                                    <property name="visible">1</property>
+                                    <property name="opacity">0</property>
+                                    <property name="icon-name">object-select-symbolic</property>
+                                    <property name="icon-size">1</property>
+                                  </object>
+                                </child>
+                                <child>
+                                  <object class="GtkRadioButton" id="numspacedefault">
+                                    <property name="label" translatable="yes">Default</property>
+                                    <property name="visible">1</property>
+                                    <property name="can_focus">1</property>
+                                    <property name="active">1</property>
+                                    <property name="draw_indicator">1</property>
+                                    <property name="valign">baseline</property>
+                                    <signal name="notify::active" handler="update_display" swapped="no"/>
+                                  </object>
+                                </child>
                               </object>
                             </child>
                             <child>
-                              <object class="GtkRadioButton" id="pnum">
-                                <property name="label" translatable="yes">Proportional</property>
+                              <object class="GtkBox">
                                 <property name="visible">1</property>
-                                <property name="can_focus">1</property>
-                                <property name="active">1</property>
-                                <property name="draw_indicator">1</property>
-                                <property name="group">numspacedefault</property>
-                                <signal name="notify::active" handler="update" swapped="no"/>
+                                <child>
+                                  <object class="GtkImage" id="pnum_pres">
+                                    <property name="visible">1</property>
+                                    <property name="icon-name">object-select-symbolic</property>
+                                    <property name="icon-size">1</property>
+                                  </object>
+                                </child>
+                                <child>
+                                  <object class="GtkRadioButton" id="pnum">
+                                    <property name="label" translatable="yes">Proportional</property>
+                                    <property name="visible">1</property>
+                                    <property name="can_focus">1</property>
+                                    <property name="active">1</property>
+                                    <property name="draw_indicator">1</property>
+                                    <property name="group">numspacedefault</property>
+                                    <property name="valign">baseline</property>
+                                    <signal name="notify::active" handler="update_display" swapped="no"/>
+                                  </object>
+                                </child>
                               </object>
-                              <packing>
-                                <property name="position">1</property>
-                              </packing>
                             </child>
                             <child>
-                              <object class="GtkRadioButton" id="tnum">
-                                <property name="label" translatable="yes">Tabular</property>
+                              <object class="GtkBox">
                                 <property name="visible">1</property>
-                                <property name="can_focus">1</property>
-                                <property name="active">1</property>
-                                <property name="draw_indicator">1</property>
-                                <property name="group">numspacedefault</property>
-                                <signal name="notify::active" handler="update" swapped="no"/>
+                                <child>
+                                  <object class="GtkImage" id="tnum_pres">
+                                    <property name="visible">1</property>
+                                    <property name="icon-name">object-select-symbolic</property>
+                                    <property name="icon-size">1</property>
+                                  </object>
+                                </child>
+                                <child>
+                                  <object class="GtkRadioButton" id="tnum">
+                                    <property name="label" translatable="yes">Tabular</property>
+                                    <property name="visible">1</property>
+                                    <property name="can_focus">1</property>
+                                    <property name="active">1</property>
+                                    <property name="draw_indicator">1</property>
+                                    <property name="group">numspacedefault</property>
+                                    <property name="valign">baseline</property>
+                                    <signal name="notify::active" handler="update_display" swapped="no"/>
+                                  </object>
+                                </child>
                               </object>
-                              <packing>
-                                <property name="position">2</property>
-                              </packing>
                             </child>
                           </object>
                         </child>
                         <child type="label">
-                          <object class="GtkLabel" id="label9">
+                          <object class="GtkLabel">
                             <property name="visible">1</property>
                             <property name="label" translatable="yes">Number Spacing</property>
                           </object>
                         </child>
                       </object>
-                      <packing>
-                        <property name="position">5</property>
-                      </packing>
                     </child>
                     <child>
-                      <object class="GtkExpander" id="expander9">
+                      <object class="GtkExpander">
                         <property name="visible">1</property>
                         <property name="can_focus">1</property>
                         <child>
-                          <object class="GtkBox" id="box7">
+                          <object class="GtkBox">
                             <property name="visible">1</property>
-                            <property name="margin_start">20</property>
-                            <property name="margin_end">20</property>
+                            <property name="margin_start">10</property>
+                            <property name="margin_end">10</property>
                             <property name="margin_top">10</property>
                             <property name="orientation">vertical</property>
                             <child>
-                              <object class="GtkRadioButton" id="fractiondefault">
-                                <property name="label" translatable="yes">Off</property>
+                              <object class="GtkBox">
                                 <property name="visible">1</property>
-                                <property name="can_focus">1</property>
-                                <property name="active">1</property>
-                                <property name="draw_indicator">1</property>
-                                <signal name="notify::active" handler="update" swapped="no"/>
+                                <child>
+                                  <object class="GtkImage" id="fractiondefault_pres">
+                                    <property name="visible">1</property>
+                                    <property name="opacity">0</property>
+                                    <property name="icon-name">object-select-symbolic</property>
+                                    <property name="icon-size">1</property>
+                                  </object>
+                                </child>
+                                <child>
+                                  <object class="GtkRadioButton" id="fractiondefault">
+                                    <property name="label" translatable="yes">Off</property>
+                                    <property name="visible">1</property>
+                                    <property name="can_focus">1</property>
+                                    <property name="active">1</property>
+                                    <property name="draw_indicator">1</property>
+                                    <property name="valign">baseline</property>
+                                    <signal name="notify::active" handler="update_display" swapped="no"/>
+                                  </object>
+                                </child>
                               </object>
                             </child>
                             <child>
-                              <object class="GtkRadioButton" id="frac">
-                                <property name="label" translatable="yes">Normal</property>
+                              <object class="GtkBox">
                                 <property name="visible">1</property>
-                                <property name="can_focus">1</property>
-                                <property name="active">1</property>
-                                <property name="draw_indicator">1</property>
-                                <property name="group">fractiondefault</property>
-                                <signal name="notify::active" handler="update" swapped="no"/>
+                                <child>
+                                  <object class="GtkImage" id="frac_pres">
+                                    <property name="visible">1</property>
+                                    <property name="icon-name">object-select-symbolic</property>
+                                    <property name="icon-size">1</property>
+                                  </object>
+                                </child>
+                                <child>
+                                  <object class="GtkRadioButton" id="frac">
+                                    <property name="label" translatable="yes">Normal</property>
+                                    <property name="visible">1</property>
+                                    <property name="can_focus">1</property>
+                                    <property name="active">1</property>
+                                    <property name="draw_indicator">1</property>
+                                    <property name="group">fractiondefault</property>
+                                    <property name="valign">baseline</property>
+                                    <signal name="notify::active" handler="update_display" swapped="no"/>
+                                  </object>
+                                </child>
                               </object>
-                              <packing>
-                                <property name="position">1</property>
-                              </packing>
                             </child>
                             <child>
-                              <object class="GtkRadioButton" id="afrc">
-                                <property name="label" translatable="yes">Alternate</property>
+                              <object class="GtkBox">
                                 <property name="visible">1</property>
-                                <property name="can_focus">1</property>
-                                <property name="active">1</property>
-                                <property name="draw_indicator">1</property>
-                                <property name="group">fractiondefault</property>
-                                <signal name="notify::active" handler="update" swapped="no"/>
+                                <child>
+                                  <object class="GtkImage" id="afrc_pres">
+                                    <property name="visible">1</property>
+                                    <property name="icon-name">object-select-symbolic</property>
+                                    <property name="icon-size">1</property>
+                                  </object>
+                                </child>
+                                <child>
+                                  <object class="GtkRadioButton" id="afrc">
+                                    <property name="label" translatable="yes">Alternate</property>
+                                    <property name="visible">1</property>
+                                    <property name="can_focus">1</property>
+                                    <property name="active">1</property>
+                                    <property name="draw_indicator">1</property>
+                                    <property name="group">fractiondefault</property>
+                                    <property name="valign">baseline</property>
+                                    <signal name="notify::active" handler="update_display" swapped="no"/>
+                                  </object>
+                                </child>
                               </object>
-                              <packing>
-                                <property name="position">2</property>
-                              </packing>
                             </child>
                           </object>
                         </child>
                         <child type="label">
-                          <object class="GtkLabel" id="label10">
+                          <object class="GtkLabel">
                             <property name="visible">1</property>
                             <property name="label" translatable="yes">Fractions</property>
                           </object>
                         </child>
                       </object>
-                      <packing>
-                        <property name="position">6</property>
-                      </packing>
                     </child>
                     <child>
-                      <object class="GtkExpander" id="expander10">
+                      <object class="GtkExpander">
                         <property name="visible">1</property>
                         <property name="can_focus">1</property>
                         <child>
-                          <object class="GtkBox" id="box8">
+                          <object class="GtkBox">
                             <property name="visible">1</property>
-                            <property name="margin_start">20</property>
-                            <property name="margin_end">20</property>
+                            <property name="margin_start">10</property>
+                            <property name="margin_end">10</property>
                             <property name="margin_top">10</property>
                             <property name="orientation">vertical</property>
                             <child>
-                              <object class="GtkBox" id="box21">
+                              <object class="GtkBox">
                                 <property name="visible">1</property>
                                 <child>
+                                  <object class="GtkImage" id="zero_pres">
+                                    <property name="visible">1</property>
+                                    <property name="icon-name">object-select-symbolic</property>
+                                    <property name="icon-size">1</property>
+                                  </object>
+                                </child>
+                                <child>
                                   <object class="GtkCheckButton" id="zero_dflt">
                                     <property name="visible">1</property>
                                     <property name="can_focus">1</property>
                                     <property name="draw_indicator">1</property>
-                                    <signal name="notify::active" handler="update" swapped="no"/>
+                                    <property name="valign">baseline</property>
+                                    <signal name="notify::active" handler="update_display" swapped="no"/>
                                   </object>
                                 </child>
                                 <child>
@@ -533,214 +828,605 @@
                                     <property name="visible">1</property>
                                     <property name="can_focus">1</property>
                                     <property name="draw_indicator">1</property>
-                                    <signal name="notify::active" handler="update" swapped="no"/>
+                                    <property name="valign">baseline</property>
+                                    <signal name="notify::active" handler="update_display" swapped="no"/>
                                     <property name="sensitive" bind-source="zero_dflt" 
bind-property="active" bind-flags="sync-create|bidirectional"/>
                                   </object>
-                                  <packing>
-                                    <property name="position">1</property>
-                                  </packing>
                                 </child>
                               </object>
                             </child>
                             <child>
-                              <object class="GtkBox" id="box22">
+                              <object class="GtkBox">
                                 <property name="visible">1</property>
                                 <child>
+                                  <object class="GtkImage" id="nalt_pres">
+                                    <property name="visible">1</property>
+                                    <property name="icon-name">object-select-symbolic</property>
+                                    <property name="icon-size">1</property>
+                                  </object>
+                                </child>
+                                <child>
                                   <object class="GtkCheckButton" id="nalt_dflt">
                                     <property name="visible">1</property>
                                     <property name="can_focus">1</property>
                                     <property name="draw_indicator">1</property>
-                                    <signal name="notify::active" handler="update" swapped="no"/>
+                                    <property name="valign">baseline</property>
+                                    <signal name="notify::active" handler="update_display" swapped="no"/>
                                   </object>
                                 </child>
                                 <child>
                                   <object class="GtkCheckButton" id="nalt">
-                                    <property name="label" translatable="yes">Alt. Annotation</property>
+                                    <property name="label" translatable="yes">Alternative 
Annotations</property>
                                     <property name="visible">1</property>
                                     <property name="can_focus">1</property>
                                     <property name="draw_indicator">1</property>
-                                    <signal name="notify::active" handler="update" swapped="no"/>
+                                    <property name="valign">baseline</property>
+                                    <signal name="notify::active" handler="update_display" swapped="no"/>
                                     <property name="sensitive" bind-source="nalt_dflt" 
bind-property="active" bind-flags="sync-create|bidirectional"/>
                                   </object>
-                                  <packing>
-                                    <property name="position">1</property>
-                                  </packing>
                                 </child>
                               </object>
-                              <packing>
-                                <property name="position">1</property>
-                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkBox">
+                                <property name="visible">1</property>
+                                <child>
+                                  <object class="GtkImage" id="sinf_pres">
+                                    <property name="visible">1</property>
+                                    <property name="icon-name">object-select-symbolic</property>
+                                    <property name="icon-size">1</property>
+                                  </object>
+                                </child>
+                                <child>
+                                  <object class="GtkCheckButton" id="sinf_dflt">
+                                    <property name="visible">1</property>
+                                    <property name="can_focus">1</property>
+                                    <property name="draw_indicator">1</property>
+                                    <property name="valign">baseline</property>
+                                    <signal name="notify::active" handler="update_display" swapped="no"/>
+                                  </object>
+                                </child>
+                                <child>
+                                  <object class="GtkCheckButton" id="sinf">
+                                    <property name="label" translatable="yes">Scientific Inferiors</property>
+                                    <property name="visible">1</property>
+                                    <property name="can_focus">1</property>
+                                    <property name="draw_indicator">1</property>
+                                    <property name="valign">baseline</property>
+                                    <signal name="notify::active" handler="update_display" swapped="no"/>
+                                    <property name="sensitive" bind-source="sinf_dflt" 
bind-property="active" bind-flags="sync-create|bidirectional"/>
+                                  </object>
+                                </child>
+                              </object>
                             </child>
                           </object>
                         </child>
                         <child type="label">
-                          <object class="GtkLabel" id="label11">
+                          <object class="GtkLabel">
                             <property name="visible">1</property>
                             <property name="label" translatable="yes">Numeric Extras</property>
                           </object>
                         </child>
                       </object>
-                      <packing>
-                        <property name="position">7</property>
-                      </packing>
                     </child>
                     <child>
-                      <object class="GtkExpander" id="expander11">
+                      <object class="GtkExpander">
                         <property name="visible">1</property>
                         <property name="can_focus">1</property>
                         <child>
-                          <object class="GtkBox" id="box9">
+                          <object class="GtkBox">
                             <property name="visible">1</property>
-                            <property name="margin_start">20</property>
-                            <property name="margin_end">20</property>
+                            <property name="margin_start">10</property>
+                            <property name="margin_end">10</property>
                             <property name="margin_top">10</property>
                             <property name="orientation">vertical</property>
                             <child>
-                              <object class="GtkBox" id="box28">
+                              <object class="GtkBox">
                                 <property name="visible">1</property>
                                 <child>
+                                  <object class="GtkImage" id="swsh_pres">
+                                    <property name="visible">1</property>
+                                    <property name="icon-name">object-select-symbolic</property>
+                                    <property name="icon-size">1</property>
+                                  </object>
+                                </child>
+                                <child>
                                   <object class="GtkCheckButton" id="swsh_dflt">
                                     <property name="visible">1</property>
                                     <property name="can_focus">1</property>
                                     <property name="draw_indicator">1</property>
-                                    <signal name="notify::active" handler="update" swapped="no"/>
+                                    <property name="valign">baseline</property>
+                                    <signal name="notify::active" handler="update_display" swapped="no"/>
                                   </object>
                                 </child>
                                 <child>
                                   <object class="GtkCheckButton" id="swsh">
-                                    <property name="label" translatable="yes">Swash</property>
+                                    <property name="label" translatable="yes">Swash Glyphs</property>
                                     <property name="visible">1</property>
                                     <property name="can_focus">1</property>
                                     <property name="draw_indicator">1</property>
-                                    <signal name="notify::active" handler="update" swapped="no"/>
+                                    <property name="valign">baseline</property>
+                                    <signal name="notify::active" handler="update_display" swapped="no"/>
                                     <property name="sensitive" bind-source="swsh_dflt" 
bind-property="active" bind-flags="sync-create|bidirectional"/>
                                   </object>
-                                  <packing>
-                                    <property name="position">1</property>
-                                  </packing>
                                 </child>
                               </object>
                             </child>
                             <child>
-                              <object class="GtkBox" id="box29">
+                              <object class="GtkBox">
+                                <property name="visible">1</property>
+                                <child>
+                                  <object class="GtkImage" id="cswh_pres">
+                                    <property name="visible">1</property>
+                                    <property name="icon-name">object-select-symbolic</property>
+                                    <property name="icon-size">1</property>
+                                  </object>
+                                </child>
+                                <child>
+                                  <object class="GtkCheckButton" id="cswh_dflt">
+                                    <property name="visible">1</property>
+                                    <property name="can_focus">1</property>
+                                    <property name="draw_indicator">1</property>
+                                    <property name="valign">baseline</property>
+                                    <signal name="notify::active" handler="update_display" swapped="no"/>
+                                  </object>
+                                </child>
+                                <child>
+                                  <object class="GtkCheckButton" id="cswh">
+                                    <property name="label" translatable="yes">Contextual Swash</property>
+                                    <property name="visible">1</property>
+                                    <property name="can_focus">1</property>
+                                    <property name="draw_indicator">1</property>
+                                    <property name="valign">baseline</property>
+                                    <signal name="notify::active" handler="update_display" swapped="no"/>
+                                    <property name="sensitive" bind-source="cswh_dflt" 
bind-property="active" bind-flags="sync-create|bidirectional"/>
+                                  </object>
+                                </child>
+                              </object>
+                            </child>
+                            <child>
+                              <object class="GtkBox">
+                                <property name="visible">1</property>
+                                <child>
+                                  <object class="GtkImage" id="locl_pres">
+                                    <property name="visible">1</property>
+                                    <property name="icon-name">object-select-symbolic</property>
+                                    <property name="icon-size">1</property>
+                                  </object>
+                                </child>
+                                <child>
+                                  <object class="GtkCheckButton" id="locl_dflt">
+                                    <property name="visible">1</property>
+                                    <property name="can_focus">1</property>
+                                    <property name="draw_indicator">1</property>
+                                    <property name="valign">baseline</property>
+                                    <signal name="notify::active" handler="update_display" swapped="no"/>
+                                  </object>
+                                </child>
+                                <child>
+                                  <object class="GtkCheckButton" id="locl">
+                                    <property name="label" translatable="yes">Localized Forms</property>
+                                    <property name="visible">1</property>
+                                    <property name="can_focus">1</property>
+                                    <property name="draw_indicator">1</property>
+                                    <property name="valign">baseline</property>
+                                    <signal name="notify::active" handler="update_display" swapped="no"/>
+                                    <property name="sensitive" bind-source="locl_dflt" 
bind-property="active" bind-flags="sync-create|bidirectional"/>
+                                  </object>
+                                </child>
+                              </object>
+                            </child>
+                            <child>
+                              <object class="GtkBox">
                                 <property name="visible">1</property>
                                 <child>
+                                  <object class="GtkImage" id="calt_pres">
+                                    <property name="visible">1</property>
+                                    <property name="icon-name">object-select-symbolic</property>
+                                    <property name="icon-size">1</property>
+                                  </object>
+                                </child>
+                                <child>
                                   <object class="GtkCheckButton" id="calt_dflt">
                                     <property name="visible">1</property>
                                     <property name="can_focus">1</property>
                                     <property name="draw_indicator">1</property>
-                                    <signal name="notify::active" handler="update" swapped="no"/>
+                                    <property name="valign">baseline</property>
+                                    <signal name="notify::active" handler="update_display" swapped="no"/>
                                   </object>
                                 </child>
                                 <child>
                                   <object class="GtkCheckButton" id="calt">
-                                    <property name="label" translatable="yes">Contextual</property>
+                                    <property name="label" translatable="yes">Contextual 
Alternatives</property>
                                     <property name="visible">1</property>
                                     <property name="can_focus">1</property>
                                     <property name="draw_indicator">1</property>
-                                    <signal name="notify::active" handler="update" swapped="no"/>
+                                    <property name="valign">baseline</property>
+                                    <signal name="notify::active" handler="update_display" swapped="no"/>
                                     <property name="sensitive" bind-source="calt_dflt" 
bind-property="active" bind-flags="sync-create|bidirectional"/>
                                   </object>
-                                  <packing>
-                                    <property name="position">1</property>
-                                  </packing>
                                 </child>
                               </object>
-                              <packing>
-                                <property name="position">1</property>
-                              </packing>
                             </child>
                             <child>
-                              <object class="GtkBox" id="box30">
+                              <object class="GtkBox">
                                 <property name="visible">1</property>
                                 <child>
+                                  <object class="GtkImage" id="hist_pres">
+                                    <property name="visible">1</property>
+                                    <property name="icon-name">object-select-symbolic</property>
+                                    <property name="icon-size">1</property>
+                                  </object>
+                                </child>
+                                <child>
                                   <object class="GtkCheckButton" id="hist_dflt">
                                     <property name="visible">1</property>
                                     <property name="can_focus">1</property>
                                     <property name="draw_indicator">1</property>
-                                    <signal name="notify::active" handler="update" swapped="no"/>
+                                    <property name="valign">baseline</property>
+                                    <signal name="notify::active" handler="update_display" swapped="no"/>
                                   </object>
                                 </child>
                                 <child>
                                   <object class="GtkCheckButton" id="hist">
-                                    <property name="label" translatable="yes">Historical</property>
+                                    <property name="label" translatable="yes">Historical 
Alternatives</property>
                                     <property name="visible">1</property>
                                     <property name="can_focus">1</property>
                                     <property name="draw_indicator">1</property>
-                                    <signal name="notify::active" handler="update" swapped="no"/>
+                                    <property name="valign">baseline</property>
+                                    <signal name="notify::active" handler="update_display" swapped="no"/>
                                     <property name="sensitive" bind-source="hist_dflt" 
bind-property="active" bind-flags="sync-create|bidirectional"/>
                                   </object>
-                                  <packing>
-                                    <property name="position">1</property>
-                                  </packing>
                                 </child>
                               </object>
-                              <packing>
-                                <property name="position">2</property>
-                              </packing>
                             </child>
                             <child>
-                              <object class="GtkBox" id="box31">
+                              <object class="GtkBox">
                                 <property name="visible">1</property>
                                 <child>
+                                  <object class="GtkImage" id="salt_pres">
+                                    <property name="visible">1</property>
+                                    <property name="icon-name">object-select-symbolic</property>
+                                    <property name="icon-size">1</property>
+                                  </object>
+                                </child>
+                                <child>
                                   <object class="GtkCheckButton" id="salt_dflt">
                                     <property name="visible">1</property>
                                     <property name="can_focus">1</property>
                                     <property name="draw_indicator">1</property>
-                                    <signal name="notify::active" handler="update" swapped="no"/>
+                                    <property name="valign">baseline</property>
+                                    <signal name="notify::active" handler="update_display" swapped="no"/>
                                   </object>
                                 </child>
                                 <child>
                                   <object class="GtkCheckButton" id="salt">
-                                    <property name="label" translatable="yes">Stylistic</property>
+                                    <property name="label" translatable="yes">Stylistic 
Alternatives</property>
                                     <property name="visible">1</property>
                                     <property name="can_focus">1</property>
                                     <property name="draw_indicator">1</property>
-                                    <signal name="notify::active" handler="update" swapped="no"/>
+                                    <property name="valign">baseline</property>
+                                    <signal name="notify::active" handler="update_display" swapped="no"/>
                                     <property name="sensitive" bind-source="salt_dflt" 
bind-property="active" bind-flags="sync-create|bidirectional"/>
                                   </object>
-                                  <packing>
-                                    <property name="position">1</property>
-                                  </packing>
                                 </child>
                               </object>
-                              <packing>
-                                <property name="position">3</property>
-                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkBox">
+                                <property name="visible">1</property>
+                                <child>
+                                  <object class="GtkImage" id="titl_pres">
+                                    <property name="visible">1</property>
+                                    <property name="icon-name">object-select-symbolic</property>
+                                    <property name="icon-size">1</property>
+                                  </object>
+                                </child>
+                                <child>
+                                  <object class="GtkCheckButton" id="titl_dflt">
+                                    <property name="visible">1</property>
+                                    <property name="can_focus">1</property>
+                                    <property name="draw_indicator">1</property>
+                                    <property name="valign">baseline</property>
+                                    <signal name="notify::active" handler="update_display" swapped="no"/>
+                                  </object>
+                                </child>
+                                <child>
+                                  <object class="GtkCheckButton" id="titl">
+                                    <property name="label" translatable="yes">Titling Alternatives</property>
+                                    <property name="visible">1</property>
+                                    <property name="can_focus">1</property>
+                                    <property name="draw_indicator">1</property>
+                                    <property name="valign">baseline</property>
+                                    <signal name="notify::active" handler="update_display" swapped="no"/>
+                                    <property name="sensitive" bind-source="titl_dflt" 
bind-property="active" bind-flags="sync-create|bidirectional"/>
+                                  </object>
+                                </child>
+                              </object>
+                            </child>
+                            <child>
+                              <object class="GtkBox">
+                                <property name="visible">1</property>
+                                <child>
+                                  <object class="GtkImage" id="rand_pres">
+                                    <property name="visible">1</property>
+                                    <property name="icon-name">object-select-symbolic</property>
+                                    <property name="icon-size">1</property>
+                                  </object>
+                                </child>
+                                <child>
+                                  <object class="GtkCheckButton" id="rand_dflt">
+                                    <property name="visible">1</property>
+                                    <property name="can_focus">1</property>
+                                    <property name="draw_indicator">1</property>
+                                    <property name="valign">baseline</property>
+                                    <signal name="notify::active" handler="update_display" swapped="no"/>
+                                  </object>
+                                </child>
+                                <child>
+                                  <object class="GtkCheckButton" id="rand">
+                                    <property name="label" translatable="yes">Randomize</property>
+                                    <property name="visible">1</property>
+                                    <property name="can_focus">1</property>
+                                    <property name="draw_indicator">1</property>
+                                    <property name="valign">baseline</property>
+                                    <signal name="notify::active" handler="update_display" swapped="no"/>
+                                    <property name="sensitive" bind-source="rand_dflt" 
bind-property="active" bind-flags="sync-create|bidirectional"/>
+                                  </object>
+                                </child>
+                              </object>
+                            </child>
+                            <child>
+                              <object class="GtkBox">
+                                <property name="visible">1</property>
+                                <child>
+                                  <object class="GtkImage" id="subs_pres">
+                                    <property name="visible">1</property>
+                                    <property name="icon-name">object-select-symbolic</property>
+                                    <property name="icon-size">1</property>
+                                  </object>
+                                </child>
+                                <child>
+                                  <object class="GtkCheckButton" id="subs_dflt">
+                                    <property name="visible">1</property>
+                                    <property name="can_focus">1</property>
+                                    <property name="draw_indicator">1</property>
+                                    <property name="valign">baseline</property>
+                                    <signal name="notify::active" handler="update_display" swapped="no"/>
+                                  </object>
+                                </child>
+                                <child>
+                                  <object class="GtkCheckButton" id="subs">
+                                    <property name="label" translatable="yes">Subscript</property>
+                                    <property name="visible">1</property>
+                                    <property name="can_focus">1</property>
+                                    <property name="draw_indicator">1</property>
+                                    <property name="valign">baseline</property>
+                                    <signal name="notify::active" handler="update_display" swapped="no"/>
+                                    <property name="sensitive" bind-source="subs_dflt" 
bind-property="active" bind-flags="sync-create|bidirectional"/>
+                                  </object>
+                                </child>
+                              </object>
+                            </child>
+                            <child>
+                              <object class="GtkBox">
+                                <property name="visible">1</property>
+                                <child>
+                                  <object class="GtkImage" id="sups_pres">
+                                    <property name="visible">1</property>
+                                    <property name="icon-name">object-select-symbolic</property>
+                                    <property name="icon-size">1</property>
+                                  </object>
+                                </child>
+                                <child>
+                                  <object class="GtkCheckButton" id="sups_dflt">
+                                    <property name="visible">1</property>
+                                    <property name="can_focus">1</property>
+                                    <property name="draw_indicator">1</property>
+                                    <property name="valign">baseline</property>
+                                    <signal name="notify::active" handler="update_display" swapped="no"/>
+                                  </object>
+                                </child>
+                                <child>
+                                  <object class="GtkCheckButton" id="sups">
+                                    <property name="label" translatable="yes">Superscript</property>
+                                    <property name="visible">1</property>
+                                    <property name="can_focus">1</property>
+                                    <property name="draw_indicator">1</property>
+                                    <property name="valign">baseline</property>
+                                    <signal name="notify::active" handler="update_display" swapped="no"/>
+                                    <property name="sensitive" bind-source="sups_dflt" 
bind-property="active" bind-flags="sync-create|bidirectional"/>
+                                  </object>
+                                </child>
+                              </object>
                             </child>
                           </object>
                         </child>
                         <child type="label">
-                          <object class="GtkLabel" id="label12">
+                          <object class="GtkLabel">
                             <property name="visible">1</property>
                             <property name="label" translatable="yes">Character Alternatives</property>
                           </object>
                         </child>
                       </object>
-                      <packing>
-                        <property name="position">8</property>
-                      </packing>
                     </child>
                     <child>
-                      <object class="GtkExpander" id="expander12">
+                      <object class="GtkExpander">
                         <property name="visible">1</property>
                         <property name="can_focus">1</property>
                         <child>
-                          <object class="GtkBox" id="box10">
+                          <object class="GtkBox">
                             <property name="visible">1</property>
-                            <property name="margin_start">20</property>
-                            <property name="margin_end">20</property>
+                            <property name="margin_start">10</property>
+                            <property name="margin_end">10</property>
                             <property name="margin_top">10</property>
                             <property name="orientation">vertical</property>
                             <child>
-                              <object class="GtkBox" id="box23">
+                              <object class="GtkBox">
+                                <property name="visible">1</property>
+                                <child>
+                                  <object class="GtkImage" id="init_pres">
+                                    <property name="visible">1</property>
+                                    <property name="icon-name">object-select-symbolic</property>
+                                    <property name="icon-size">1</property>
+                                  </object>
+                                </child>
+                                <child>
+                                  <object class="GtkCheckButton" id="init_dflt">
+                                    <property name="visible">1</property>
+                                    <property name="can_focus">1</property>
+                                    <property name="draw_indicator">1</property>
+                                    <property name="valign">baseline</property>
+                                    <signal name="notify::active" handler="update_display" swapped="no"/>
+                                  </object>
+                                </child>
+                                <child>
+                                  <object class="GtkCheckButton" id="init">
+                                    <property name="label" translatable="yes">Initial Forms</property>
+                                    <property name="visible">1</property>
+                                    <property name="can_focus">1</property>
+                                    <property name="draw_indicator">1</property>
+                                    <property name="valign">baseline</property>
+                                    <signal name="notify::active" handler="update_display" swapped="no"/>
+                                    <property name="sensitive" bind-source="init_dflt" 
bind-property="active" bind-flags="sync-create|bidirectional"/>
+                                  </object>
+                                </child>
+                              </object>
+                            </child>
+                            <child>
+                              <object class="GtkBox">
+                                <property name="visible">1</property>
+                                <child>
+                                  <object class="GtkImage" id="medi_pres">
+                                    <property name="visible">1</property>
+                                    <property name="icon-name">object-select-symbolic</property>
+                                    <property name="icon-size">1</property>
+                                  </object>
+                                </child>
+                                <child>
+                                  <object class="GtkCheckButton" id="medi_dflt">
+                                    <property name="visible">1</property>
+                                    <property name="can_focus">1</property>
+                                    <property name="draw_indicator">1</property>
+                                    <property name="valign">baseline</property>
+                                    <signal name="notify::active" handler="update_display" swapped="no"/>
+                                  </object>
+                                </child>
+                                <child>
+                                  <object class="GtkCheckButton" id="medi">
+                                    <property name="label" translatable="yes">Medial Forms</property>
+                                    <property name="visible">1</property>
+                                    <property name="can_focus">1</property>
+                                    <property name="draw_indicator">1</property>
+                                    <property name="valign">baseline</property>
+                                    <signal name="notify::active" handler="update_display" swapped="no"/>
+                                    <property name="sensitive" bind-source="medi_dflt" 
bind-property="active" bind-flags="sync-create|bidirectional"/>
+                                  </object>
+                                </child>
+                              </object>
+                            </child>
+                            <child>
+                              <object class="GtkBox">
                                 <property name="visible">1</property>
                                 <child>
+                                  <object class="GtkImage" id="fina_pres">
+                                    <property name="visible">1</property>
+                                    <property name="icon-name">object-select-symbolic</property>
+                                    <property name="icon-size">1</property>
+                                  </object>
+                                </child>
+                                <child>
+                                  <object class="GtkCheckButton" id="fina_dflt">
+                                    <property name="visible">1</property>
+                                    <property name="can_focus">1</property>
+                                    <property name="draw_indicator">1</property>
+                                    <property name="valign">baseline</property>
+                                    <signal name="notify::active" handler="update_display" swapped="no"/>
+                                  </object>
+                                </child>
+                                <child>
+                                  <object class="GtkCheckButton" id="fina">
+                                    <property name="label" translatable="yes">Final Forms</property>
+                                    <property name="visible">1</property>
+                                    <property name="can_focus">1</property>
+                                    <property name="draw_indicator">1</property>
+                                    <property name="valign">baseline</property>
+                                    <signal name="notify::active" handler="update_display" swapped="no"/>
+                                    <property name="sensitive" bind-source="fina_dflt" 
bind-property="active" bind-flags="sync-create|bidirectional"/>
+                                  </object>
+                                </child>
+                              </object>
+                            </child>
+                            <child>
+                              <object class="GtkBox">
+                                <property name="visible">1</property>
+                                <child>
+                                  <object class="GtkImage" id="isol_pres">
+                                    <property name="visible">1</property>
+                                    <property name="icon-name">object-select-symbolic</property>
+                                    <property name="icon-size">1</property>
+                                  </object>
+                                </child>
+                                <child>
+                                  <object class="GtkCheckButton" id="isol_dflt">
+                                    <property name="visible">1</property>
+                                    <property name="can_focus">1</property>
+                                    <property name="draw_indicator">1</property>
+                                    <property name="valign">baseline</property>
+                                    <signal name="notify::active" handler="update_display" swapped="no"/>
+                                  </object>
+                                </child>
+                                <child>
+                                  <object class="GtkCheckButton" id="isol">
+                                    <property name="label" translatable="yes">Isolated Forms</property>
+                                    <property name="visible">1</property>
+                                    <property name="can_focus">1</property>
+                                    <property name="draw_indicator">1</property>
+                                    <property name="valign">baseline</property>
+                                    <signal name="notify::active" handler="update_display" swapped="no"/>
+                                    <property name="sensitive" bind-source="isol_dflt" 
bind-property="active" bind-flags="sync-create|bidirectional"/>
+                                  </object>
+                                </child>
+                              </object>
+                            </child>
+                          </object>
+                        </child>
+                        <child type="label">
+                          <object class="GtkLabel">
+                            <property name="visible">1</property>
+                            <property name="label" translatable="yes">Positional Alternatives</property>
+                          </object>
+                        </child>
+                      </object>
+                    </child>
+                    <child>
+                      <object class="GtkExpander">
+                        <property name="visible">1</property>
+                        <property name="can_focus">1</property>
+                        <child>
+                          <object class="GtkBox">
+                            <property name="visible">1</property>
+                            <property name="margin_start">10</property>
+                            <property name="margin_end">10</property>
+                            <property name="margin_top">10</property>
+                            <property name="orientation">vertical</property>
+                            <child>
+                              <object class="GtkBox">
+                                <property name="visible">1</property>
+                                <child>
+                                  <object class="GtkImage" id="ss01_pres">
+                                    <property name="visible">1</property>
+                                    <property name="icon-name">object-select-symbolic</property>
+                                    <property name="icon-size">1</property>
+                                  </object>
+                                </child>
+                                <child>
                                   <object class="GtkCheckButton" id="ss01_dflt">
                                     <property name="visible">1</property>
                                     <property name="can_focus">1</property>
                                     <property name="draw_indicator">1</property>
-                                    <signal name="notify::active" handler="update" swapped="no"/>
+                                    <property name="valign">baseline</property>
+                                    <signal name="notify::active" handler="update_display" swapped="no"/>
                                   </object>
                                 </child>
                                 <child>
@@ -749,24 +1435,30 @@
                                     <property name="visible">1</property>
                                     <property name="can_focus">1</property>
                                     <property name="draw_indicator">1</property>
-                                    <signal name="notify::active" handler="update" swapped="no"/>
+                                    <property name="valign">baseline</property>
+                                    <signal name="notify::active" handler="update_display" swapped="no"/>
                                     <property name="sensitive" bind-source="ss01_dflt" 
bind-property="active" bind-flags="sync-create|bidirectional"/>
                                   </object>
-                                  <packing>
-                                    <property name="position">1</property>
-                                  </packing>
                                 </child>
                               </object>
                             </child>
                             <child>
-                              <object class="GtkBox" id="box24">
+                              <object class="GtkBox">
                                 <property name="visible">1</property>
                                 <child>
+                                  <object class="GtkImage" id="ss02_pres">
+                                    <property name="visible">1</property>
+                                    <property name="icon-name">object-select-symbolic</property>
+                                    <property name="icon-size">1</property>
+                                  </object>
+                                </child>
+                                <child>
                                   <object class="GtkCheckButton" id="ss02_dflt">
                                     <property name="visible">1</property>
                                     <property name="can_focus">1</property>
                                     <property name="draw_indicator">1</property>
-                                    <signal name="notify::active" handler="update" swapped="no"/>
+                                    <property name="valign">baseline</property>
+                                    <signal name="notify::active" handler="update_display" swapped="no"/>
                                   </object>
                                 </child>
                                 <child>
@@ -775,27 +1467,30 @@
                                     <property name="visible">1</property>
                                     <property name="can_focus">1</property>
                                     <property name="draw_indicator">1</property>
-                                    <signal name="notify::active" handler="update" swapped="no"/>
+                                    <property name="valign">baseline</property>
+                                    <signal name="notify::active" handler="update_display" swapped="no"/>
                                     <property name="sensitive" bind-source="ss02_dflt" 
bind-property="active" bind-flags="sync-create|bidirectional"/>
                                   </object>
-                                  <packing>
-                                    <property name="position">1</property>
-                                  </packing>
                                 </child>
                               </object>
-                              <packing>
-                                <property name="position">1</property>
-                              </packing>
                             </child>
                             <child>
-                              <object class="GtkBox" id="box25">
+                              <object class="GtkBox">
                                 <property name="visible">1</property>
                                 <child>
+                                  <object class="GtkImage" id="ss03_pres">
+                                    <property name="visible">1</property>
+                                    <property name="icon-name">object-select-symbolic</property>
+                                    <property name="icon-size">1</property>
+                                  </object>
+                                </child>
+                                <child>
                                   <object class="GtkCheckButton" id="ss03_dflt">
                                     <property name="visible">1</property>
                                     <property name="can_focus">1</property>
                                     <property name="draw_indicator">1</property>
-                                    <signal name="notify::active" handler="update" swapped="no"/>
+                                    <property name="valign">baseline</property>
+                                    <signal name="notify::active" handler="update_display" swapped="no"/>
                                   </object>
                                 </child>
                                 <child>
@@ -804,27 +1499,30 @@
                                     <property name="visible">1</property>
                                     <property name="can_focus">1</property>
                                     <property name="draw_indicator">1</property>
-                                    <signal name="notify::active" handler="update" swapped="no"/>
+                                    <property name="valign">baseline</property>
+                                    <signal name="notify::active" handler="update_display" swapped="no"/>
                                     <property name="sensitive" bind-source="ss03_dflt" 
bind-property="active" bind-flags="sync-create|bidirectional"/>
                                   </object>
-                                  <packing>
-                                    <property name="position">1</property>
-                                  </packing>
                                 </child>
                               </object>
-                              <packing>
-                                <property name="position">2</property>
-                              </packing>
                             </child>
                             <child>
-                              <object class="GtkBox" id="box26">
+                              <object class="GtkBox">
                                 <property name="visible">1</property>
                                 <child>
+                                  <object class="GtkImage" id="ss04_pres">
+                                    <property name="visible">1</property>
+                                    <property name="icon-name">object-select-symbolic</property>
+                                    <property name="icon-size">1</property>
+                                  </object>
+                                </child>
+                                <child>
                                   <object class="GtkCheckButton" id="ss04_dflt">
                                     <property name="visible">1</property>
                                     <property name="can_focus">1</property>
                                     <property name="draw_indicator">1</property>
-                                    <signal name="notify::active" handler="update" swapped="no"/>
+                                    <property name="valign">baseline</property>
+                                    <signal name="notify::active" handler="update_display" swapped="no"/>
                                   </object>
                                 </child>
                                 <child>
@@ -833,27 +1531,30 @@
                                     <property name="visible">1</property>
                                     <property name="can_focus">1</property>
                                     <property name="draw_indicator">1</property>
-                                    <signal name="notify::active" handler="update" swapped="no"/>
+                                    <property name="valign">baseline</property>
+                                    <signal name="notify::active" handler="update_display" swapped="no"/>
                                     <property name="sensitive" bind-source="ss04_dflt" 
bind-property="active" bind-flags="sync-create|bidirectional"/>
                                   </object>
-                                  <packing>
-                                    <property name="position">1</property>
-                                  </packing>
                                 </child>
                               </object>
-                              <packing>
-                                <property name="position">3</property>
-                              </packing>
                             </child>
                             <child>
-                              <object class="GtkBox" id="box27">
+                              <object class="GtkBox">
                                 <property name="visible">1</property>
                                 <child>
+                                  <object class="GtkImage" id="ss05_pres">
+                                    <property name="visible">1</property>
+                                    <property name="icon-name">object-select-symbolic</property>
+                                    <property name="icon-size">1</property>
+                                  </object>
+                                </child>
+                                <child>
                                   <object class="GtkCheckButton" id="ss05_dflt">
                                     <property name="visible">1</property>
                                     <property name="can_focus">1</property>
                                     <property name="draw_indicator">1</property>
-                                    <signal name="notify::active" handler="update" swapped="no"/>
+                                    <property name="valign">baseline</property>
+                                    <signal name="notify::active" handler="update_display" swapped="no"/>
                                   </object>
                                 </child>
                                 <child>
@@ -862,30 +1563,22 @@
                                     <property name="visible">1</property>
                                     <property name="can_focus">1</property>
                                     <property name="draw_indicator">1</property>
-                                    <signal name="notify::active" handler="update" swapped="no"/>
+                                    <property name="valign">baseline</property>
+                                    <signal name="notify::active" handler="update_display" swapped="no"/>
                                     <property name="sensitive" bind-source="ss05_dflt" 
bind-property="active" bind-flags="sync-create|bidirectional"/>
                                   </object>
-                                  <packing>
-                                    <property name="position">1</property>
-                                  </packing>
                                 </child>
                               </object>
-                              <packing>
-                                <property name="position">4</property>
-                              </packing>
                             </child>
                           </object>
                         </child>
                         <child type="label">
-                          <object class="GtkLabel" id="label13">
+                          <object class="GtkLabel">
                             <property name="visible">1</property>
                             <property name="label" translatable="yes">Alternative Stylistic Sets</property>
                           </object>
                         </child>
                       </object>
-                      <packing>
-                        <property name="position">9</property>
-                      </packing>
                     </child>
                   </object>
                 </child>
@@ -897,7 +1590,7 @@
           </object>
         </child>
         <child>
-          <object class="GtkBox" id="box12">
+          <object class="GtkBox">
             <property name="visible">1</property>
             <property name="orientation">vertical</property>
             <child>
@@ -928,19 +1621,21 @@
                 <child>
                   <object class="GtkEntry" id="entry">
                     <property name="visible">1</property>
-                    <property name="text">Lucky affluent actor asks to feast on giant 10.34&quot; 
cheese-filled quiche in fjord.</property>
+                    <property name="text">Grumpy wizards make toxic brew for the evil Queen and Jack. A 
quick movement of the enemy will jeopardize six gunboats. The job of waxing linoleum frequently peeves 
chintzy kids. My girl wove six dozen plaid jackets before she quit. Twelve ziggurats quickly jumped a finch 
box.
+
+Разъяренный чтец эгоистично бьёт пятью жердями шустрого фехтовальщика. Наш банк вчера же выплатил Ф.Я. 
Эйхгольду комиссию за ценные вещи. Эх, чужак, общий съём цен шляп (юфть) – вдрызг! В чащах юга жил бы цитрус? 
Да, но фальшивый экземпляр!
+
+Τάχιστη αλώπηξ βαφής ψημένη γη, δρασκελίζει υπέρ νωθρού κυνός</property>
                     <signal name="key-press-event" handler="entry_key_press"/>
                     <signal name="activate" handler="switch_to_label"/>
                     <property name="valign">start</property>
+                    <property name="width-chars">50</property>
                   </object>
                   <packing>
                     <property name="name">entry</property>
                   </packing>
                 </child>
               </object>
-              <packing>
-                <property name="expand">1</property>
-              </packing>
             </child>
             <child>
               <object class="GtkLabel" id="settings">
@@ -949,15 +1644,17 @@
                 <property name="margin_end">20</property>
                 <property name="margin_bottom">20</property>
                 <property name="xalign">0</property>
+                <property name="valign">end</property>
+                <property name="width-chars">50</property>
+                <property name="max-width-chars">50</property>
               </object>
               <packing>
-                <property name="position">1</property>
+                <property name="expand">1</property>
               </packing>
             </child>
           </object>
           <packing>
             <property name="expand">1</property>
-            <property name="position">1</property>
           </packing>
         </child>
       </object>
diff --git a/demos/gtk-demo/font_features.c b/demos/gtk-demo/font_features.c
index a65979a..761bf8f 100644
--- a/demos/gtk-demo/font_features.c
+++ b/demos/gtk-demo/font_features.c
@@ -1,15 +1,23 @@
 /* Pango/Font Features
  *
- * This demonstrates support for OpenType font features with
- * Pango attributes. The attributes can be used manually or
- * via Pango markup.
+ * This example demonstrates support for OpenType font features with
+ * Pango attributes. The attributes can be used manually or via Pango
+ * markup.
+ *
+ * It can also be used to explore available features in OpenType fonts
+ * and their effect.
  */
 
 #include <gtk/gtk.h>
+#include <pango/pangofc-font.h>
+#include <hb.h>
+#include <hb-ot.h>
+#include <hb-ft.h>
 
 static GtkWidget *label;
 static GtkWidget *settings;
 static GtkWidget *font;
+static GtkWidget *script_lang;
 static GtkWidget *resetbutton;
 static GtkWidget *numcasedefault;
 static GtkWidget *numspacedefault;
@@ -17,10 +25,19 @@ static GtkWidget *fractiondefault;
 static GtkWidget *stack;
 static GtkWidget *entry;
 
-static GtkWidget *toggle[24];
+#define num_features 40
+
+static GtkWidget *toggle[num_features];
+static GtkWidget *icon[num_features];
+static const char *feature_names[num_features] = {
+  "kern", "liga", "dlig", "hlig", "clig", "smcp", "c2sc", "pcap", "c2pc", "unic",
+  "cpsp", "case", "lnum", "onum", "pnum", "tnum", "frac", "afrc", "zero", "nalt",
+  "sinf", "swsh", "cswh", "locl", "calt", "hist", "salt", "titl", "rand", "subs",
+  "sups", "init", "medi", "fina", "isol", "ss01", "ss02", "ss03", "ss04", "ss05"
+};
 
 static void
-update (void)
+update_display (void)
 {
   GString *s;
   char *font_desc;
@@ -28,6 +45,10 @@ update (void)
   const char *text;
   gboolean has_feature;
   int i;
+  hb_tag_t lang_tag;
+  GtkTreeModel *model;
+  GtkTreeIter iter;
+  const char *lang;
 
   text = gtk_entry_get_text (GTK_ENTRY (entry));
 
@@ -36,7 +57,7 @@ update (void)
   s = g_string_new ("");
 
   has_feature = FALSE;
-  for (i = 0; i < 24; i++)
+  for (i = 0; i < num_features; i++)
     {
       if (!gtk_widget_is_sensitive (toggle[i]))
         continue;
@@ -69,8 +90,24 @@ update (void)
 
   gtk_label_set_text (GTK_LABEL (settings), font_settings);
 
+
+  if (gtk_combo_box_get_active_iter (GTK_COMBO_BOX (script_lang), &iter))
+    {
+      model = gtk_combo_box_get_model (GTK_COMBO_BOX (script_lang));
+      gtk_tree_model_get (model, &iter,
+                          3, &lang_tag,
+                          -1);
+
+      lang = hb_language_to_string (hb_ot_tag_to_language (lang_tag));
+    }
+  else
+    lang = NULL;
+
   s = g_string_new ("");
-  g_string_append_printf (s, "<span font_desc='%s' font_features='%s'>%s</span>", font_desc, font_settings, 
text);
+  g_string_append_printf (s, "<span font_desc='%s' font_features='%s'", font_desc, font_settings);
+  if (lang)
+    g_string_append_printf (s, " lang='%s'", lang);
+  g_string_append_printf (s, ">%s</span>", text);
 
   gtk_label_set_markup (GTK_LABEL (label), s->str);
 
@@ -80,15 +117,315 @@ update (void)
   g_free (font_settings);
 }
 
+static PangoFont *
+get_pango_font (void)
+{
+  PangoFontDescription *desc;
+  PangoContext *context;
+  PangoFontMap *map;
+
+  desc = gtk_font_chooser_get_font_desc (GTK_FONT_CHOOSER (font));
+  context = gtk_widget_get_pango_context (font);
+  map = pango_context_get_font_map (context);
+
+  return pango_font_map_load_font (map, context, desc);
+}
+
+static struct { const char *name; hb_script_t script; } script_names[] = {
+  { "Common", HB_SCRIPT_COMMON },
+  { "Inherited", HB_SCRIPT_INHERITED },
+  { "Unknown", HB_SCRIPT_UNKNOWN },
+  { "Arabic", HB_SCRIPT_ARABIC },
+  { "Armenian", HB_SCRIPT_ARMENIAN },
+  { "Bengali", HB_SCRIPT_BENGALI },
+  { "Cyrillic", HB_SCRIPT_CYRILLIC },
+  { "Devanagari", HB_SCRIPT_DEVANAGARI },
+  { "Georgian", HB_SCRIPT_GEORGIAN },
+  { "Greek", HB_SCRIPT_GREEK },
+  { "Gujarati", HB_SCRIPT_GUJARATI },
+  { "Gurmukhi", HB_SCRIPT_GURMUKHI },
+  { "Hangul", HB_SCRIPT_HANGUL },
+  { "Han", HB_SCRIPT_HAN },
+  { "Hebrew", HB_SCRIPT_HEBREW },
+  { "Hiragana", HB_SCRIPT_HIRAGANA },
+  { "Kannada", HB_SCRIPT_KANNADA },
+  { "Katakana", HB_SCRIPT_KATAKANA },
+  { "Lao", HB_SCRIPT_LAO },
+  { "Latin", HB_SCRIPT_LATIN },
+  { "Malayalam", HB_SCRIPT_MALAYALAM },
+  { "Oriya", HB_SCRIPT_ORIYA },
+  { "Tamil", HB_SCRIPT_TAMIL },
+  { "Telugu", HB_SCRIPT_TELUGU },
+  { "Thai", HB_SCRIPT_THAI },
+  { "Tibetan", HB_SCRIPT_TIBETAN },
+  { "Bopomofo", HB_SCRIPT_BOPOMOFO }
+  /* FIXME: complete */
+};
+
+static struct { const char *name; hb_tag_t tag; } language_names[] = {
+  { "Arabic", HB_TAG ('A','R','A',' ') },
+  { "Romanian", HB_TAG ('R','O','M',' ') },
+  { "Skolt Sami", HB_TAG ('S','K','S',' ') },
+  { "Northern Sami", HB_TAG ('N','S','M',' ') },
+  { "Kildin Sami", HB_TAG ('K','S','M',' ') },
+  { "Moldavian", HB_TAG ('M','O','L',' ') },
+  { "Turkish", HB_TAG ('T','R','K',' ') },
+  { "Azerbaijani", HB_TAG ('A','Z','E',' ') },
+  { "Crimean Tatar", HB_TAG ('C','R','T',' ') },
+  { "Serbian", HB_TAG ('S','R','B',' ') },
+  { "German", HB_TAG ('D','E','U',' ') }
+  /* FIXME: complete */
+};
+
+typedef struct {
+  hb_tag_t script_tag;
+  hb_tag_t lang_tag;
+  unsigned int script_index;
+  unsigned int lang_index;
+} TagPair;
+
+static guint
+tag_pair_hash (gconstpointer data)
+{
+  const TagPair *pair = data;
+
+  return pair->script_tag + pair->lang_tag;
+}
+
+static gboolean
+tag_pair_equal (gconstpointer a, gconstpointer b)
+{
+  const TagPair *pair_a = a;
+  const TagPair *pair_b = b;
+
+  return pair_a->script_tag == pair_b->script_tag && pair_a->lang_tag == pair_b->lang_tag;
+}
+
+static void
+update_script_combo (void)
+{
+  GtkListStore *store;
+  hb_font_t *hb_font;
+  gint i, j, k, l;
+  FT_Face ft_face;
+  PangoFont *pango_font;
+  GHashTable *tags;
+  GHashTableIter iter;
+  TagPair *pair;
+
+  store = gtk_list_store_new (4, G_TYPE_STRING, G_TYPE_UINT, G_TYPE_UINT, G_TYPE_UINT);
+
+  pango_font = get_pango_font ();
+  ft_face = pango_fc_font_lock_face (PANGO_FC_FONT (pango_font)),
+  hb_font = hb_ft_font_create (ft_face, NULL);
+
+  tags = g_hash_table_new_full (tag_pair_hash, tag_pair_equal, g_free, NULL);
+
+  pair = g_new (TagPair, 1);
+  pair->script_tag = HB_OT_TAG_DEFAULT_SCRIPT;
+  pair->lang_tag = HB_OT_TAG_DEFAULT_LANGUAGE;
+  g_hash_table_insert (tags, pair, g_strdup ("Default"));
+
+  if (hb_font)
+    {
+      hb_tag_t tables[2] = { HB_OT_TAG_GSUB, HB_OT_TAG_GPOS };
+      hb_face_t *hb_face;
+
+      hb_face = hb_font_get_face (hb_font);
+
+      for (i= 0; i < 2; i++)
+        {
+          hb_tag_t scripts[80];
+          unsigned int script_count = G_N_ELEMENTS (scripts);
+
+          hb_ot_layout_table_get_script_tags (hb_face, tables[i], 0, &script_count, scripts);
+          for (j = 0; j < script_count; j++)
+            {
+              hb_tag_t languages[80];
+              unsigned int language_count = G_N_ELEMENTS (languages);
+
+              pair = g_new (TagPair, 1);
+              pair->script_tag = scripts[j];
+              pair->lang_tag = HB_OT_TAG_DEFAULT_LANGUAGE;
+              pair->script_index = j;
+              pair->lang_index = HB_OT_LAYOUT_DEFAULT_LANGUAGE_INDEX;
+              g_hash_table_add (tags, pair);
+
+              hb_ot_layout_script_get_language_tags (hb_face, tables[i], j, 0, &language_count, languages);
+              for (k = 0; k < language_count; k++)
+                {
+                  pair = g_new (TagPair, 1);
+                  pair->script_tag = scripts[j];
+                  pair->lang_tag = languages[k];
+                  pair->script_index = j;
+                  pair->lang_index = k;
+                  g_hash_table_add (tags, pair);
+                }
+            }
+        }
+
+      hb_face_destroy (hb_face);
+    }
+
+  pango_fc_font_unlock_face (PANGO_FC_FONT (pango_font));
+  g_object_unref (pango_font);
+
+  g_hash_table_iter_init (&iter, tags);
+  while (g_hash_table_iter_next (&iter, (gpointer *)&pair, NULL))
+    {
+      const char *scriptname;
+      char scriptbuf[5];
+      const char *langname;
+      char langbuf[5];
+      char *name;
+
+      if (pair->script_tag == HB_OT_TAG_DEFAULT_SCRIPT)
+        scriptname = "Default";
+      else if (pair->script_tag == HB_TAG ('m','a','t','h'))
+        scriptname = "Math";
+      else
+        {
+          hb_script_t script;
+
+          hb_tag_to_string (pair->script_tag, scriptbuf);
+          scriptbuf[4] = 0;
+          scriptname = scriptbuf;
+
+          script = hb_script_from_iso15924_tag (pair->script_tag);
+          for (k = 0; k < G_N_ELEMENTS (script_names); k++)
+            {
+              if (script == script_names[k].script)
+                {
+                  scriptname = script_names[k].name;
+                  break;
+                }
+            }
+        }
+
+      if (pair->lang_tag == HB_OT_TAG_DEFAULT_LANGUAGE)
+        langname = "Default";
+      else
+        {
+          hb_tag_to_string (pair->lang_tag, langbuf);
+          langbuf[4] = 0;
+          langname = langbuf;
+
+          for (l = 0; l < G_N_ELEMENTS (language_names); l++)
+            {
+              if (pair->lang_tag == language_names[l].tag)
+                {
+                  langname = language_names[l].name;
+                  break;
+                }
+            }
+        }
+
+      name = g_strdup_printf ("%s - %s", scriptname, langname);
+
+      gtk_list_store_insert_with_values (store, NULL, -1,
+                                         0, name,
+                                         1, pair->script_index,
+                                         2, pair->lang_index,
+                                         3, pair->lang_tag,
+                                         -1);
+
+      g_free (name);
+    }
+
+  g_hash_table_destroy (tags);
+
+  gtk_combo_box_set_model (GTK_COMBO_BOX (script_lang), GTK_TREE_MODEL (store));
+  gtk_combo_box_set_active (GTK_COMBO_BOX (script_lang), 0);
+}
+
+static void
+update_features (void)
+{
+  gint i, j, k;
+  GtkTreeModel *model;
+  GtkTreeIter iter;
+  guint script_index, lang_index;
+  PangoFont *pango_font;
+  FT_Face ft_face;
+  hb_font_t *hb_font;
+
+  for (i = 0; i < num_features; i++)
+    gtk_widget_set_opacity (icon[i], 0);
+
+  /* set feature presence checks from the font features */
+
+  if (!gtk_combo_box_get_active_iter (GTK_COMBO_BOX (script_lang), &iter))
+    return;
+
+  model = gtk_combo_box_get_model (GTK_COMBO_BOX (script_lang));
+  gtk_tree_model_get (model, &iter,
+                      1, &script_index,
+                      2, &lang_index,
+                      -1);
+
+  pango_font = get_pango_font ();
+  ft_face = pango_fc_font_lock_face (PANGO_FC_FONT (pango_font)),
+  hb_font = hb_ft_font_create (ft_face, NULL);
+
+  if (hb_font)
+    {
+      hb_tag_t tables[2] = { HB_OT_TAG_GSUB, HB_OT_TAG_GPOS };
+      hb_face_t *hb_face;
+
+      hb_face = hb_font_get_face (hb_font);
+
+      for (i = 0; i < 2; i++)
+        {
+          hb_tag_t features[80];
+          unsigned int count = G_N_ELEMENTS(features);
+
+          hb_ot_layout_language_get_feature_tags (hb_face,
+                                                  tables[i],
+                                                  script_index,
+                                                  lang_index,
+                                                  0,
+                                                  &count,
+                                                  features);
+
+          for (j = 0; j < count; j++)
+            {
+              for (k = 0; k < num_features; k++)
+                {
+                  if (hb_tag_from_string (feature_names[k], -1) == features[j])
+                    gtk_widget_set_opacity (icon[k], 0.5);
+                }
+            }
+        }
+
+      hb_face_destroy (hb_face);
+    }
+
+  pango_fc_font_unlock_face (PANGO_FC_FONT (pango_font));
+  g_object_unref (pango_font);
+}
+
 static void
-reset (void)
+font_changed (void)
+{
+  update_script_combo ();
+}
+
+static void
+script_changed (void)
+{
+  update_features ();
+  update_display ();
+}
+
+static void
+reset_features (void)
 {
   int i;
 
   gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (numcasedefault), TRUE);
   gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (numspacedefault), TRUE);
   gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (fractiondefault), TRUE);
-  for (i = 0; i < 24; i++)
+  for (i = 0; i < num_features; i++)
     {
       if (!GTK_IS_RADIO_BUTTON (toggle[i]))
         {
@@ -113,7 +450,7 @@ switch_to_label (void)
   g_free (text);
   text = NULL;
   gtk_stack_set_visible_child_name (GTK_STACK (stack), "label");
-  update ();
+  update_display ();
 }
 
 static gboolean
@@ -141,8 +478,10 @@ do_font_features (GtkWidget *do_widget)
 
       builder = gtk_builder_new_from_resource ("/font_features/font-features.ui");
 
-      gtk_builder_add_callback_symbol (builder, "update", update);
-      gtk_builder_add_callback_symbol (builder, "reset", reset);
+      gtk_builder_add_callback_symbol (builder, "update_display", update_display);
+      gtk_builder_add_callback_symbol (builder, "font_changed", font_changed);
+      gtk_builder_add_callback_symbol (builder, "script_changed", script_changed);
+      gtk_builder_add_callback_symbol (builder, "reset", reset_features);
       gtk_builder_add_callback_symbol (builder, "switch_to_entry", switch_to_entry);
       gtk_builder_add_callback_symbol (builder, "switch_to_label", switch_to_label);
       gtk_builder_add_callback_symbol (builder, "entry_key_press", G_CALLBACK (entry_key_press));
@@ -153,39 +492,24 @@ do_font_features (GtkWidget *do_widget)
       settings = GTK_WIDGET (gtk_builder_get_object (builder, "settings"));
       resetbutton = GTK_WIDGET (gtk_builder_get_object (builder, "reset"));
       font = GTK_WIDGET (gtk_builder_get_object (builder, "font"));
+      script_lang = GTK_WIDGET (gtk_builder_get_object (builder, "script_lang"));
       numcasedefault = GTK_WIDGET (gtk_builder_get_object (builder, "numcasedefault"));
       numspacedefault = GTK_WIDGET (gtk_builder_get_object (builder, "numspacedefault"));
       fractiondefault = GTK_WIDGET (gtk_builder_get_object (builder, "fractiondefault"));
       stack = GTK_WIDGET (gtk_builder_get_object (builder, "stack"));
       entry = GTK_WIDGET (gtk_builder_get_object (builder, "entry"));
 
-      i = 0;
-      toggle[i++] = GTK_WIDGET (gtk_builder_get_object (builder, "kern"));
-      toggle[i++] = GTK_WIDGET (gtk_builder_get_object (builder, "liga"));
-      toggle[i++] = GTK_WIDGET (gtk_builder_get_object (builder, "dlig"));
-      toggle[i++] = GTK_WIDGET (gtk_builder_get_object (builder, "hlig"));
-      toggle[i++] = GTK_WIDGET (gtk_builder_get_object (builder, "clig"));
-      toggle[i++] = GTK_WIDGET (gtk_builder_get_object (builder, "smcp"));
-      toggle[i++] = GTK_WIDGET (gtk_builder_get_object (builder, "c2sc"));
-      toggle[i++] = GTK_WIDGET (gtk_builder_get_object (builder, "lnum"));
-      toggle[i++] = GTK_WIDGET (gtk_builder_get_object (builder, "onum"));
-      toggle[i++] = GTK_WIDGET (gtk_builder_get_object (builder, "pnum"));
-      toggle[i++] = GTK_WIDGET (gtk_builder_get_object (builder, "tnum"));
-      toggle[i++] = GTK_WIDGET (gtk_builder_get_object (builder, "frac"));
-      toggle[i++] = GTK_WIDGET (gtk_builder_get_object (builder, "afrc"));
-      toggle[i++] = GTK_WIDGET (gtk_builder_get_object (builder, "zero"));
-      toggle[i++] = GTK_WIDGET (gtk_builder_get_object (builder, "nalt"));
-      toggle[i++] = GTK_WIDGET (gtk_builder_get_object (builder, "swsh"));
-      toggle[i++] = GTK_WIDGET (gtk_builder_get_object (builder, "calt"));
-      toggle[i++] = GTK_WIDGET (gtk_builder_get_object (builder, "hist"));
-      toggle[i++] = GTK_WIDGET (gtk_builder_get_object (builder, "salt"));
-      toggle[i++] = GTK_WIDGET (gtk_builder_get_object (builder, "ss01"));
-      toggle[i++] = GTK_WIDGET (gtk_builder_get_object (builder, "ss02"));
-      toggle[i++] = GTK_WIDGET (gtk_builder_get_object (builder, "ss03"));
-      toggle[i++] = GTK_WIDGET (gtk_builder_get_object (builder, "ss04"));
-      toggle[i++] = GTK_WIDGET (gtk_builder_get_object (builder, "ss05"));
-
-      update ();
+      for (i = 0; i < num_features; i++)
+        {
+          char *iname;
+
+          toggle[i] = GTK_WIDGET (gtk_builder_get_object (builder, feature_names[i]));
+          iname = g_strconcat (feature_names[i], "_pres", NULL);
+          icon[i] = GTK_WIDGET (gtk_builder_get_object (builder, iname));
+          g_free (iname);
+        }
+
+      font_changed ();
 
       g_signal_connect (window, "destroy",
                         G_CALLBACK (gtk_widget_destroyed), &window);



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