Conversion of DXF to image shows no diameter sign

I try to convert a DXF file to an image which contains a diameter sign, which isn’t rendered properly (box is shown instead).

test-5668442-1.dxf.zip (383.1 KB)
(note: this is no real zip, I had to rename it for upload, just remove “.zip”)
test-5668442-1.dxf.png (44.3 KB)

In the PDF of your online converter the diameter is shown correctly, but if I’m converting to PDF it’s still a box.

test-5668442-1.dxf.pdf (141.8 KB)
test-5668442-1_output_online_converter.pdf (108.0 KB)

I thought, that I have to change the font maybe. So I tried to substitute the fonts as proposed in the developer guide (CadStyleTableObject.setPrimaryFontName()) but I can’t see any change.
How do I have to specify the font in the method - only the name like ‘Arial’ or with extension ‘Arial.ttf’?
Which are the available fonts or do I have to specify a setting in the Aspose/Java installation?

Is this the right approach for my problem anyway?

SOURCE

public static void main(String[] args) {
    String dataDir = getDataDir();
    String srcFile = dataDir + "test-5668442-1.dxf";

    // Load a CAD drawing in an instance of CadImage
    LOG.info("Loading file... ");
    try (CadImage image = (CadImage) Image.load(srcFile)) {

        // logging
        for (Object style : image.getStyles()) {
            CadStyleTableObject cadStyle = (CadStyleTableObject) style;
            LOG.info("image styles  " + cadStyle.getStyleName() + " -> " + cadStyle.getPrimaryFontName());
        }

        LOG.info("change primary font name");
        // Iterate over the items of CadStylesDictionary and set the font name
        for (Object style : image.getStyles()) {
            ((CadStyleTableObject) style).setPrimaryFontName("roman"); // also tried roman.ttf
        }

        // logging
        for (Object style : image.getStyles()) {
            CadStyleTableObject cadStyle = (CadStyleTableObject) style;
            LOG.info("image styles  " + cadStyle.getStyleName() + " -> " + cadStyle.getPrimaryFontName());
        }

        // Create an instance of CadRasterizationOptions
        CadRasterizationOptions rasterizationOptions = new CadRasterizationOptions();
        rasterizationOptions.setDrawType(CadDrawTypeMode.UseObjectColor);
        rasterizationOptions.setPageHeight(2000);
        rasterizationOptions.setPageWidth(2000);

        // Export to PNG format
        PngOptions pngOptions = new PngOptions();
        pngOptions.setVectorRasterizationOptions(rasterizationOptions);
        image.save(srcFile + ".png", pngOptions);
    }

    LOG.info("...Finished");
}

LOGGING OUTPUT

2020-02-05 09:37:54,902 [main] INFO  test.cad.CadTest - Loading file... 
2020-02-05 09:37:57,779 [main] INFO  test.cad.CadTest - image styles  STANDARD -> monos.ttf
2020-02-05 09:37:57,779 [main] INFO  test.cad.CadTest - change primary font name
2020-02-05 09:37:57,779 [main] INFO  test.cad.CadTest - image styles  STANDARD -> roman
2020-02-05 09:38:09,014 [main] INFO  test.cad.CadTest - ...Finished

@marlov,

I have observed the issue shared by you. However, when I have tried to access the DXF zip archive, it seems to be damaged and I am unable to access that. Can you please ensure this on your end and share with us again.

see my note above: this is no real zip, I had to rename it for upload, just remove “.zip” extension

@marlov,

Thank you for the clarification. I have been able to observe the issue. An issue with ID CADNET-1020 has been created in our issue tracking system to further investigate and resolve the issue. This thread has been linked with the issue so that you may be notified once the issue will be fixed.

@mudassir.fayyaz,

I just noticed that you created a .NET-issue but I had the problem with the Java release. Will this issue be fixed for both?

Regards!

@marlov,

I have created the concerned Java ticket with ID CADJAVA-685 as well.

The issues you have found earlier (filed as CADJAVA-685) have been fixed in this update.

@mudassir.fayyaz

I tried the .dxf with the new version but I don’t see a change. Do I have to change the way I call the conversion? Do I have to use another font anyway?

Kind regards!

@marlov,

I have observed your comments. The issue state is still opened and we will share the new updates with you as soon as it will be fixed.

Hello @mudassir.fayyaz,

I have seen that CADJAVA-685 was closed but there was no notification and I haven’t found it in any release notes. Is there a fix or workaround to this issue?

Regards!

@marlov

Can you please try using latest Aspose.CAD for Java on your end and share your kind feedback in case the issue still persist.

@mudassir.fayyaz,

I did and it’s still the same. No diameter sign when rendered as an image or PDF.

Regards!

@marlov

Can you please provide the generated output so that I may append that in our issue tracking system for further investigation.

@mudassir.fayyaz

the generated image test-5668442-1.dxf.png (44.1 KB)

@marlov

I have associated information in our issue tracking system and we will get back to you with feedback as soon as it will be shared.

@mudassir.fayyaz

great, it works with version 20.12 - thanks!

Regards!

@marlov

It’s good to know that latest versions have proved to resolve the issue on your end.