You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "lehmi (via GitHub)" <gi...@apache.org> on 2023/01/27 07:09:06 UTC

[GitHub] [pdfbox] lehmi commented on a diff in pull request #153: PDFBOX-4189: Add a method to get GSUB data for specific script tag

lehmi commented on code in PR #153:
URL: https://github.com/apache/pdfbox/pull/153#discussion_r1088628537


##########
fontbox/src/main/java/org/apache/fontbox/ttf/gsub/DefaultGsubWorker.java:
##########
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.fontbox.ttf.gsub;
+
+import java.util.List;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.fontbox.ttf.GlyphSubstitutionTable;
+
+/**
+ * A default implementation of {@link GsubWorker} that actually does not transform the glyphs yet
+ * allows to correctly {@linkplain GlyphSubstitutionTable#getGsubData(String) load} GSUB table
+ * data even from fonts for which a complete glyph substitution is not implemented.
+ *
+ * @author Vladimir Plizga
+ */
+class DefaultGsubWorker implements GsubWorker
+{
+    private static final Log LOG = LogFactory.getLog(DefaultGsubWorker.class);
+
+    @Override
+    public List<Integer> applyTransforms(List<Integer> originalGlyphIds)
+    {
+        LOG.warn(getClass().getSimpleName() + " class does not perform actual GSUB substitutions. "
+                + "Perhaps the selected language is not yet supported by the FontBox library.");
+        return originalGlyphIds;

Review Comment:
   We should return either an unmodifiable version or a copy of the origin list, as the caller doesn't expect to get back the provided instance of the list. This may lead to unwanted changes of the origin list.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org