]> granicus.if.org Git - icu/commitdiff
ICU-11450 Remove LEFontInstance::getFontTable(LETag)
authorSteven R. Loomis <srl@icu-project.org>
Thu, 5 Mar 2015 06:18:56 +0000 (06:18 +0000)
committerSteven R. Loomis <srl@icu-project.org>
Thu, 5 Mar 2015 06:18:56 +0000 (06:18 +0000)
X-SVN-Rev: 37144

icu4c/readme.html
icu4c/source/layout/LEFontInstance.h
icu4c/source/layout/LayoutEngine.cpp
icu4c/source/test/letest/PortableFontInstance.cpp
icu4c/source/test/letest/PortableFontInstance.h
icu4c/source/test/letest/SimpleFontInstance.cpp
icu4c/source/test/letest/SimpleFontInstance.h

index 8abb54cc2ea227a5e82e877a8eb2eb01ebacc164..76228840bafd73a2c847deb7b6fccef4df012041 100644 (file)
@@ -5,7 +5,7 @@
   <head>
     <title>ReadMe for ICU 55.0.1 (55m1)</title>
     <meta name="COPYRIGHT" content=
-    "Copyright (c) 1997-2014 IBM Corporation and others. All Rights Reserved." />
+    "Copyright (c) 1997-2015 IBM Corporation and others. All Rights Reserved." />
     <meta name="KEYWORDS" content=
     "ICU; International Components for Unicode; ICU4C; what's new; readme; read me; introduction; downloads; downloading; building; installation;" />
     <meta name="DESCRIPTION" content=
     <p>See the <a href="APIChangeReport.html">API Change Report</a> for a complete 
     list of APIs added, removed, or changed in this release.</p>
 
+    <!-- ICU 55 items -->
+    <h3>Layout Engine: breaking API change</h3>
+    <p>The LayoutEngine (already deprecated) has had the function
+      <tt>LEFontInstance::getFontTable(LETag, size_t &length)</tt>
+      since ICU 52. Its implementation was optional. In ICU 55, this
+      version
+      of <tt>getFontTable</tt> has been made pure virtual, and the
+      version without a length (<tt>getFontTable(LETag)</tt>) has been
+      completely removed. This is a breaking change for users who have
+      not implemented the two-argument <tt>getFontTable()</tt>
+      function in their <tt>LEFontInstance</tt> subclasses.
+      The break is intentional, as the one-argument version cannot be
+      made secure. See <tt>LEFontInstance</tt> api docs for more detail.
+    </p>
+
+
     <!-- ICU 54 items -->
     <h3>Deprecation: Layout Engine</h3>
     <p>The LayoutEngine is now deprecated. Please
index d84a1f1cb8fb8441ce1ef9be1473acfed1299421..82a93bf47dda7671a60c30a79812530393d62c32 100644 (file)
@@ -1,7 +1,7 @@
 
 /*
  *
- * (C) Copyright IBM Corp. 1998-2014 - All Rights Reserved
+ * (C) Copyright IBM Corp. 1998-2015 - All Rights Reserved
  *
  */
 
@@ -156,39 +156,13 @@ public:
      *
      * Subclasses which represent composite fonts should always return <code>NULL</code>.
      *
-     * Note that implementing this function does not allow for range checking.
-     * Subclasses that desire the safety of range checking must implement the
-     * variation which has a length parameter.
-     *
-     * @param tableTag - the four byte table tag. (e.g. 'cmap')
-     *
-     * @return the address of the table in memory, or <code>NULL</code>
-     *         if the table doesn't exist.
-     *
-     * @deprecated ICU 54. See {@link icu::LayoutEngine}
-     */
-    virtual const void *getFontTable(LETag tableTag) const = 0;
-
-    /**
-     * This method reads a table from the font. Note that in general,
-     * it only makes sense to call this method on an <code>LEFontInstance</code>
-     * which represents a physical font - i.e. one which has been returned by
-     * <code>getSubFont()</code>. This is because each subfont in a composite font
-     * will have different tables, and there's no way to know which subfont to access.
-     *
-     * Subclasses which represent composite fonts should always return <code>NULL</code>.
-     *
-     * This version sets a length, for range checking.
-     * Note that range checking can only be accomplished if this function is
-     * implemented in subclasses.
-     *
      * @param tableTag - the four byte table tag. (e.g. 'cmap')
      * @param length - ignored on entry, on exit will be the length of the table if known, or -1 if unknown.
      * @return the address of the table in memory, or <code>NULL</code>
      *         if the table doesn't exist.
      * @deprecated ICU 54. See {@link LayoutEngine}
      */
-    virtual const void* getFontTable(LETag tableTag, size_t &length) const { length=-1; return getFontTable(tableTag); }  /* -1 = unknown length */
+    virtual const void* getFontTable(LETag tableTag, size_t &length) const = 0;
 
     /**
      * This method is used to determine if the font can
index 34125ab7d318c892f2bb952922051c06b96947c3..3e4d345686a7c4a62e1d960623e4a62a55ef7f8c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * (C) Copyright IBM Corp. and others 1998-2014 - All Rights Reserved
+ * (C) Copyright IBM Corp. and others 1998-2015 - All Rights Reserved
  */
 
 #include "LETypes.h"
@@ -606,9 +606,9 @@ LayoutEngine *LayoutEngine::layoutEngineFactory(const LEFontInstance *fontInstan
             break;
         }
     } else {
-        MorphTableHeader2 *morxTable = (MorphTableHeader2 *)fontInstance->getFontTable(morxTableTag);
-        if (morxTable != NULL && SWAPL(morxTable->version)==0x00020000) {
-            result = new GXLayoutEngine2(fontInstance, scriptCode, languageCode, morxTable, typoFlags, success);
+        LEReferenceTo<MorphTableHeader2> morxTable(fontInstance, morxTableTag, success);
+        if (LE_SUCCESS(success) && morxTable.isValid() && SWAPL(morxTable->version)==0x00020000) {
+          result = new GXLayoutEngine2(fontInstance, scriptCode, languageCode, morxTable, typoFlags, success);
         } else {
           LEReferenceTo<MorphTableHeader> mortTable(fontInstance, mortTableTag, success);
           if (LE_SUCCESS(success) && mortTable.isValid() && SWAPL(mortTable->version)==0x00010000) { // mort
index 907ac4ab3acd052e1ce33d8a210936fe8ea6bf93..5c968b2545de3682332319bd6d8afdfdf3a23c87 100644 (file)
@@ -1,7 +1,7 @@
 /*
  *******************************************************************************
  *
- *   Copyright (C) 1999-2014, International Business Machines
+ *   Copyright (C) 1999-2015, International Business Machines
  *   Corporation and others.  All Rights Reserved.
  *
  *******************************************************************************
@@ -250,12 +250,6 @@ const void *PortableFontInstance::readTable(LETag tag, le_uint32 *length) const
     return table;
 }
 
-const void *PortableFontInstance::getFontTable(LETag tableTag) const
-{
-  size_t ignored;
-  return getFontTable(tableTag, ignored);
-}
-
 const void *PortableFontInstance::getFontTable(LETag tableTag, size_t &length) const
 {
   return FontTableCache::find(tableTag, length);
index ed366e9f7a0c0efa24b001f7f50d5ba6fcdae2e3..41f6c355a367962af63cea2d07b5f8bf287add57 100644 (file)
@@ -2,7 +2,7 @@
 /*
  *******************************************************************************
  *
- *   Copyright (C) 1999-2013, International Business Machines
+ *   Copyright (C) 1999-2015, International Business Machines
  *   Corporation and others.  All Rights Reserved.
  *
  *******************************************************************************
@@ -71,7 +71,6 @@ public:
 
     virtual ~PortableFontInstance();
 
-    virtual const void *getFontTable(LETag tableTag) const;
     virtual const void *getFontTable(LETag tableTag, size_t &length) const;
 
     virtual const char *getNameString(le_uint16 nameID, le_uint16 platform, le_uint16 encoding, le_uint16 language) const;
index 30849f734842648ce09beb88b9868b68380664f0..d4bba3d94561367876fe7ac5a14896418048fb30 100644 (file)
@@ -1,7 +1,7 @@
 /*
  *******************************************************************************
  *
- *   Copyright (C) 1999-2014, International Business Machines
+ *   Copyright (C) 1999-2015, International Business Machines
  *   Corporation and others.  All Rights Reserved.
  *
  *******************************************************************************
@@ -41,8 +41,9 @@ SimpleFontInstance::~SimpleFontInstance()
     // nothing to do...
 }
 
-const void *SimpleFontInstance::getFontTable(LETag tableTag) const
+const void *SimpleFontInstance::getFontTable(LETag tableTag, size_t &length) const
 {
+  length = -1; // unknown for this test.
 #ifndef USING_ICULEHB
     if (tableTag == LE_GSUB_TABLE_TAG) {
         return CanonShaping::glyphSubstitutionTable;
index 9c13659dc299270b9af36b7f3d114d87b0d9702c..5f95747a8a7a251cfb0a51f7c2569b9c31825278 100644 (file)
@@ -1,7 +1,7 @@
 /*
  *******************************************************************************
  *
- *   Copyright (C) 1999-2007, International Business Machines
+ *   Copyright (C) 1999-2015, International Business Machines
  *   Corporation and others.  All Rights Reserved.
  *
  *******************************************************************************
@@ -34,7 +34,7 @@ public:
 
     virtual ~SimpleFontInstance();
 
-    virtual const void *getFontTable(LETag tableTag) const;
+    virtual const void *getFontTable(LETag tableTag, size_t &length) const;
 
     virtual le_int32 getUnitsPerEM() const;