How to access Asian/Latin font in chart legends / axis labels / textboxes?

Hi,

Many thanks for the follow-up. In fact we considered it as an issue (not only a new feature) because it had impact on the existing image rendering feature. A chart with this kind of settings cannot be rendered properly to an image. Please find my test code below:

var workbook = new Workbook(@“test.xlsx”);
var options = new ImageOrPrintOptions
{
ImageFormat = ImageFormat.Emf,
ChartImageType = ImageFormat.Emf,
OnlyArea = false,
TextRenderingHint = TextRenderingHint.ClearTypeGridFit,
OnePagePerSheet = true
};
workbook.Worksheets[0].Charts[0].ToImage(@“testout.emf”, options);

I’ve attached the test files for your reference. As you can see if I copy/paste manually using Office the fonts are correct for both Asian and Latin characters, while if I used Aspose rendering the font were wrong for Asian text (Please see my screenshot).

screenshot.png (13.9 KB)
test files.zip (60.0 KB)

I wanted to attach the font file (simkai.tff for KaiTI) for your convenience but the file size exceeded the limit, so if you still need the font file please let me know the alternative method to provide, otherwise you can use any Asian font to reproduce the issue.

Could you please check the attachments and see if the image rendering is a separate issue and could it be fixed?

Thanks

@ServerSide527

Thanks for using Aspose APIs.

You get rendering error because this feature i.e. CELLSNET-46058 is not supported at the moment. Once, this feature is implemented, we think, rendering problems of the chart should also be resolved.

However, we have tested your code and found the rendering problem in chart so we have recorded it as follows.

  • CELLSNET-46062 - Legend of Chart is not rendered properly because of Asian and Latin Characters

@ServerSide527

We only input the name of the font in MS Excel UI, but there are 4 attributes for <a:ea font in the file. i.e.

<a:ea typeface="MS Gothic" panose="020B0609070205080204" pitchFamily="49" charset="-128"/>

We could not simply get other 3 attributes by the font’s name. If you insist on this feature, please list your needed fonts’ names.

Hi,

Thanks for the investigation.

I believe we only need Aspose to access the properties that we can naturally access using Ms Excel, if there’s no equivalent in Ms Office (as in, they are hard-coded in Excel), we should be in the good place. We expect Aspose to behave the same as in office, but we don’t expect it to access anything beyond using Office manually.

Hope this could clarify your question.

Thanks

@ServerSide527

Thanks for using Aspose APIs.

We have logged your comment in our database for further consideration and evaluation. Once, we will have some news for you, we will update you asap.

Hi,

I have noticed in 18.5 release note it mentioned “Adds TextOptions.FarEastName and TextOptions.LatinName properties”.

Regarding ticket 46058, I have tried myself and noticed I could indeed access the FarEast font and the Latin font. However I still couldn’t find a way to access these options in chart legend. Is there any update on this?

Regarding ticket 46062, I understand if the ticket above is still on going, this is not expected to have been fixed at the moment. But I already noticed some text alignment issue in the image if I tried to render a shape with such settings using my code in How to access Asian/Latin font in chart legends / axis labels / textboxes? - #7 by ServerSide527 and the new test template I’ve attached:
image.png (105.5 KB)
testfilesfor1851.zip (29.7 KB)

I hope this could help your further development on this feature.

Thanks

@ServerSide527

Thanks for using Aspose APIs.

You should use 18.5.1 instead of 18.5. We have added the following properties for your needs.


Adds TextOptions.FarEastName and TextOptions.LatinName property

Get and sets the Far East and Latin name of the font.


You can download 18.5.1 from NuGet

NuGet Gallery | Aspose.Cells 18.5.1

or from the following links.


Please note:

We are still working on supporting them for Charts.

Hi,

In fact the version I tested this morning was 18.5.1 already and all my conclusion and comments above were based on this version (including the alignment issue in rendering).

I’m looking forward this feature fully supported in charts and the image text alignment issue being corrected.

Thanks

@ServerSide527

Thanks for using Aspose APIs.

I have tested this issue with your sample code (as shown below) and sample Excel file and it generated the correct output Emf image.

There might be some issues in it however, you should elaborate them clearly by highlighting them as they are not easily noticeable.

Download Link:
Output EMF.zip (4.6 KB)
testfilesfor1851.zip (29.7 KB)

C#

var workbook = new Workbook("test.xlsx");
var options = new ImageOrPrintOptions
{
    ImageFormat = ImageFormat.Emf,
    ChartImageType = ImageFormat.Emf,
    OnlyArea = false,
    TextRenderingHint = TextRenderingHint.ClearTypeGridFit,
    OnePagePerSheet = true,
    HorizontalResolution =200,
    VerticalResolution = 200
};
workbook.Worksheets[0].Charts[0].ToImage(@"output.emf", options);

Hi,

Thanks for looking into this. Looks like your pc didn’t have the Asian font I used installed. The font for Asian is KaiTi. (You can see the font in my screenshot is different from your screenshot)

image.png (95.7 KB)

I couldn’t attach the font because of the size limit on the forum, but you may find it here: Download KaiTi Font - Thousands of fonts to download for free

Thanks,

@ServerSide527

Thanks for using Aspose APIs.

KaiTi font is already installed on my machine and when I try to install the font that is downloaded from your location (URL), I get the message that this font is already installed on your machine.

Please see the following screenshots.



Hi,

Many thanks for checking this. I had a look again and think it might be the Latin font, not the Asian font. Please see my screenshot where you can see the Latin text in your output looks different than the one in Excel/my output:
image.png (92.8 KB)

I’ve attached the font file for your convenience. Could you please kindly check?

SHOWG.zip (33.2 KB)

Thanks

@ServerSide527

Thanks for the further information and using Aspose.Cells.

We were able to observe the text alignment issue in the chart image and logged it in our database for investigation and for a fix. Once, we will have some news for you about it, we will update you in this topic.

This issue has been logged as

  • CELLSNET-46149 - Text Alignment Issue in the Chart Image

@ServerSide527,
Please try our latest version/fix: Aspose.Cells for .NET v20.4.6 (attached)

Your issue should be fixed in it.

Let us know your feedback.

Aspose.Cells20.4.6 For .NetStandard20.Zip (5.3 MB)
Aspose.Cells20.4.6 For .Net2_AuthenticodeSigned.Zip (5.3 MB)
Aspose.Cells20.4.6 For .Net4.0.Zip (5.4 MB)

The issues you have found earlier (filed as CELLSNET-46149) have been fixed in Aspose.Cells for .NET v20.5. This message was posted using Bugs notification tool by Amjad_Sahi

@ServerSide527,

Please try our latest version/fix: Aspose.Cells for .NET v20.5.3 (attached)
Aspose.Cells20.5.3 For .Net2_AuthenticodeSigned.Zip (5.4 MB)
Aspose.Cells20.5.3 For .Net4.0.Zip (5.4 MB)

Your issue “CELLSNET-46062” should be fixed in it.

Let us know your feedback.

The issues you have found earlier (filed as CELLSNET-46062) have been fixed in Aspose.Cells for .NET v20.6. you may also get the version @ NuGet repos. here (NuGet Gallery | Aspose.Cells 20.6.0).This message was posted using Bugs notification tool by Amjad_Sahi

The issues you have found earlier (filed as CELLSNET-46062) have been fixed in Aspose.Cells for .NET v20.6. you may also get the version @ NuGet repos. here (NuGet Gallery | Aspose.Cells 20.6.0).This message was posted using Bugs notification tool by Amjad_Sahi

Hi,

Thanks for the updates. I tried to upgrade today and can see Font class is now also TextOptions which has access to Latin and FarEast font names.

However, there’s a regression related to the font names that blocked my upgrade. I noticed the font name of legend entries are incorrect in the new version.

Code:
var workbook = new Workbook(@".\test.xlsx");
var chart = workbook.Worksheets[0].Charts[0];
// var fontLatinNameOfLegendEntry = ((TextOptions)chart.NSeries[0].LegendEntry.Font).LatinName;
var fontNameOfLegendEntry = chart.NSeries[0].LegendEntry.Font.Name; // Returns correctly as ‘Arial’ in 20.3.0 but wrong ‘Calibri’ in 20.6.0

Supposedly the font name of the series legend entry should be ‘Arial’ which was the case in the old Aspose version, however, in the new version, it is using ‘Calibri’.

I’ve attached my test file here:
test.zip (28.1 KB)

Could you please take a look?

Thanks,

@ServerSide527,

Thanks for the details and source file.

As you already escalated it in enterprise support desk, so you may follow up your thread to get updates or fixed version. Hopefully your issue will be fixed soon.