Anonymous avatar Anonymous committed 486ba8e

tmp_otf02: #i112466#: minor fix to how OT features are read

Comments (0)

Files changed (1)

vcl/win/source/gdi/winlayout.cxx

     const char * temp  = aFamilyName.GetBuffer();
     int nSize = strlen(temp); 
     bool feature = false;
-
-    mpOFR = new OPENTYPE_FEATURE_RECORD[ 24 ]; // size is arbitrary at this point
+    mpOFR = new OPENTYPE_FEATURE_RECORD[ 64 ]; // size is arbitrary at this point
     int nOFRC = 0;
+
+    // Some default features
+    mpOFR[nOFRC].tagFeature = 'k' | ('e' << 8) | ('r' << 16) | ('n' << 24);
+    mpOFR[nOFRC].lParameter = 1;
+    nOFRC++;
+    mpOFR[nOFRC].tagFeature = 'l' | ('i' << 8) | ('g' << 16) | ('a' << 24);
+    mpOFR[nOFRC].lParameter = 1;
+    nOFRC++;
+    mpOFR[nOFRC].tagFeature = 'o' | ('n' << 8) | ('u' << 16) | ('m' << 24);
+    mpOFR[nOFRC].lParameter = 1;
+    nOFRC++;
+    mpOFR[nOFRC].tagFeature = 'p' | ('n' << 8) | ('u' << 16) | ('m' << 24);
+    mpOFR[nOFRC].lParameter = 1;
+    nOFRC++;
+
     for (int j = 0; j < nSize;j++)
     {
         if (feature == true)
         {
-            mpOFR[nOFRC].tagFeature =  temp[j]
-                                    | (temp[j+1] << 8)
-                                    | (temp[j+2] << 16)
-                                    | (temp[j+3] << 24);
-            mpOFR[nOFRC].lParameter = temp[j+5] - '0';
-            nOFRC++;
+            OPENTYPE_TAG tempTag = temp[j]
+                                 | (temp[j+1] << 8)
+                                 | (temp[j+2] << 16)
+                                 | (temp[j+3] << 24);
+            int tempVal = temp[j+5] - '0';
+            // Check if tag is already in OT feature recrod array
+            // add to end of array if it isn't
+            for ( int k = 0; k < nOFRC ; k++ )
+            {
+                if ( tempTag == mpOFR[k].tagFeature )
+                {
+                    mpOFR[k].lParameter = tempVal;
+                    break;
+                }
+                if ( k == (nOFRC - 1) ) {
+                    mpOFR[nOFRC].tagFeature = tempTag;
+                    mpOFR[nOFRC].lParameter = tempVal;
+                    nOFRC++;
+                }
+            } 
             feature = false;
         }
         if (temp[j] == ':')
             feature = true;
     };
-    //
 
     TEXTRANGE_PROPERTIES *pTTP, tTP; pTTP = &tTP;
     tTP.potfRecords = mpOFR;
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.