[ 
https://issues.apache.org/jira/browse/PDFBOX-5436?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17538104#comment-17538104
 ] 

wai edited comment on PDFBOX-5436 at 5/17/22 10:43 AM:
-------------------------------------------------------

[~msahyoun] I have Chinese characters that their glyphs come from multiple 
fonts(i.e. mingliu.ttc and mingliub.ttc). Setting either font as the 
DefaultAppearance is not possible as the glyph may appear in another font. 
Without enforcing the font being used in the field, Acrobat Reader can render 
those field correctly by using system fonts.
 
+Chinese characters sample+

 㭉㕦 (\u3B49\u3566)
all glyph from mingliu.ttc

𡖖𨥈𥖄𨋢 (\uD845\uDD96\uD862\uDD48\uD855\uDD84\uD860\uDEE2)
all glyph from mingliub.ttc

鄺𡖖𨥈琼 (\u913A\uD845\uDD96\uD862\uDD48\u743C)
\u913A - glyph from mingliu.ttc
\uD845\uDD96\uD862\uDD48 - glyph from mingliub.ttc
\u743C - glyph from mingliu.ttc

㭉埗㕦𨋢 (\u3B49\u57D7\u3566\uEB78\uD860\uDEE2)
\u3B49\u57D7\u3566\uEB78 - glyph from mingliu.ttc
\uD860\uDEE2 - glyph from mingliub.ttc
 
!image-2022-05-17-18-36-33-378.png!


was (Author: JIRAUSER289567):
[~msahyoun] I have Chinese characters that their glyphs come from multiple 
fonts(i.e. mingliu.ttc and mingliub.ttc). Setting either font as the 
DefaultAppearance is not possible as the glyph may appear in another font. 
Without enforcing the font being used in the field, Acrobat Reader can render 
those field correctly by using system fonts.
 
+Chinese characters sample+
 
||Text in Field||unicode||glyph in font||
|{color:#ff8b00}㭉㕦{color}|"{color:#ff8b00}\u3B49\u3566{color}"|all from 
mingliu.ttc|
|{color:#00875a}𡖖𨥈𥖄𨋢{color}|"{color:#00875a}\uD845\uDD96\uD862\uDD48\uD855\uDD84\uD860\uDEE2{color}"|all
 from mingliub.ttc|
|{color:#ff8b00}鄺{color:#00875a}𡖖𨥈{color}琼{color}|"{color:#00875a}{color:#ff8b00}\u913A{color}\uD845\uDD96\uD862\uDD48{color:#ff8b00}\u743C{color}{color}"|{color:#ff8b00}\u913A{color}
 - mingliu.ttc
{color:#00875a}\uD845\uDD96\uD862\uDD48{color} - mingliub.ttc
{color:#ff8b00}\u743C{color} - mingliu.ttc|
|{color:#00875a}{color:#ff8b00}㭉埗㕦{color}𨋢{color}|"{color:#ff8b00}\u3B49\u57D7\u3566\uEB78{color:#00875a}\uD860\uDEE2{color}{color}"|{color:#ff8b00}\u3B49\u57D7\u3566\uEB78{color}
 - mingliu.ttc
{color:#00875a}\uD860\uDEE2{color} - mingliub.ttc|
 
!image-2022-05-17-18-36-33-378.png!

> PDTerminalField.applyChange() no longer check for 
> getAcroForm().getNeedAppearances()
> ------------------------------------------------------------------------------------
>
>                 Key: PDFBOX-5436
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-5436
>             Project: PDFBox
>          Issue Type: Bug
>          Components: AcroForm
>    Affects Versions: 3.0.0 PDFBox
>            Reporter: wai
>            Priority: Major
>         Attachments: image-2022-05-17-18-36-33-378.png
>
>
> In version 2.0.26, I fill fields in PDF form by
> {code:java}
> PDDocument pdf = ...; // loaded a PDF form
> PDAcroForm pdfForm = pdf.getDocumentCatalog().getAcroForm(); 
> pdfForm.setNeedAppearances(true);
> pdfForm.getField("field_name_xxxx").setValue("some text");{code}
> Although the PDF form doesn't contain all glyph for the text set, 
> {{org.apache.pdfbox.pdmodel.interactive.form.PDTerminalField.applyChange()}} 
> would not apply {{constructAppearances()}} as {{setNeedAppearances(true)}} 
> configured.
> However when we come to version 3.0.0-alpha3, 
> {{PDTerminalField.applyChange()}} won't check the status from 
> {{getAcroForm().getNeedAppearances()}} before invoking 
> {{{}constructAppearances(){}}}. This behaviour contradicted the comment wrote 
> "{{{}Applies a value change to the field. Generates appearances if required 
> and raises events.{}}}"
> +version 2.0.26+
>  
> {code:java}
> package org.apache.pdfbox.pdmodel.interactive.form;
> public abstract class PDTerminalField extends PDField
> {
>     /**
>      * Applies a value change to the field. Generates appearances if required 
> and raises events.
>      * 
>      * @throws IOException if the appearance couldn't be generated
>      */
>     protected final void applyChange() throws IOException
>     {
>         if (!getAcroForm().getNeedAppearances())
>         {
>             constructAppearances();
>         }
>         // if we supported JavaScript we would raise a field changed event 
> here
>     }{code}
>  
> +3.0.0-alpha3+
>  
> {code:java}
> package org.apache.pdfbox.pdmodel.interactive.form;
> public abstract class PDTerminalField extends PDField
> { 
>     /**
>      * Applies a value change to the field. Generates appearances if required 
> and raises events.
>      * 
>      * @throws IOException if the appearance couldn't be generated
>      */
>     protected final void applyChange() throws IOException
>     {
>         constructAppearances();
>         // if we supported JavaScript we would raise a field changed event 
> here
>     }{code}
>  
>  
>  
>  
>  



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

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

Reply via email to