Dear Aspose support,
apparently I am not able to use the HarfBuzzTextShaper plugin with Aspose.words for Java (I’m currently using version 24.11).
I found reference in the online documentation explaining how to enable, but in my code I cannot find the relevant class (HarfBuzzTextShaperFactory); and searching online it seems that this plugin is only available for .NET?
Can you please spare some hints/clarifications?
Thank you
Kind Regards
@fabrizio.vaglia
It seems that the HarfBuzzTextShaper
plugin is currently only supported in the .NET version of Aspose.Words and not in the Java version. Consequently, you won’t find the HarfBuzzTextShaperFactory
class in the Java implementation, as it is specific to .NET.
If you are looking to utilize OpenType features in Java, you can use the Aspose.Words.Shaping.HarfBuzz
package, which allows for basic text shaping capabilities. However, the advanced features provided by the HarfBuzzTextShaper
are not available.
For more detailed information about enabling OpenType features in Aspose.Words for Java, you may want to refer to the documentation related to text shaper objects and how to implement them in your Java applications.
If you need further assistance or have other questions, feel free to ask!
Sources:
[1]: Enable OpenType Features in Java|Aspose.Words for Java
Sorry, the page you referenced provides a code snippet which does not work.
I think that human expertise here can provide more authoritative response whether OpenType support can be enabled or not in Java.
Have you got the capability to notify someone that human intervention is desired to get an actual answer here?
@fabrizio.vaglia Advanced typography features are supported by Aspose.Words via Aspose.Words.Shaping.HarfBuzz. You should be install the above package
<dependency>
<groupId>com.aspose</groupId>
<artifactId>aspose-words</artifactId>
<version>25.6</version>
<classifier>jdk17</classifier>
</dependency>
<dependency>
<groupId>com.aspose</groupId>
<artifactId>aspose-words</artifactId>
<version>25.6</version>
<classifier>shaping-harfbuzz-plugin</classifier>
</dependency>
and modify the code as shown below:
// Open a document
Document doc = new Document("in.docx");
// When text shaper factory is set, layout starts to use OpenType features.
// An Instance property returns static BasicTextShaperCache object wrapping HarfBuzzTextShaperFactory
doc.getLayoutOptions().setTextShaperFactory(com.aspose.words.shaping.harfbuzz.HarfBuzzTextShaperFactory.getInstance());
// Render the document to PDF format
doc.save("out.pdf");
See more about advanced typograph features in the documentation:
https://docs.aspose.com/words/java/enable-opentype-features/
Many thanks for the feedback, I’ll bump the version and try again.
1 Like
Hello,
using the latest Aspose.Words version as suggested I get definitely the expected output; I also had to make available at runtime the emoji font present in the system.
My issue is basically fixed, I’m only left with a curiosity: when I open the document in MS Word emojis are coloured, in the pdf rendering they are black and white.
Is there some additional mechanism that can be unleashed to render colored emojis?
Thanks for all the provided support,
Kind Regards
@fabrizio.vaglia Unfortunately, Aspose.Words does not support color fonts. This feature request is logged as WORDSNET-22379.