I am using highcharts in C# .net application with javascript.
The code that overrides the behavior of highchart call (for test):
var originalHighcharts = $.fn.highcharts;
$.fn.highcharts = function (options) {
var additionalSettings = {
series: [{
name: `${'עברית'}`, // Hebrew series name
dataLabels: {
enabled: true,
useHTML: true,
style: {
direction: 'rtl',
unicodeBidi: 'bidi-override',
textAlign: 'right'
}
}
}],
plotOptions: {
series: {
shadow: false
}
},
exporting: {
fallbackToExportServer: false,
pdfFont: {
normal: '/Content/fonts/DavidLibre-Regular.ttf',
bold: '/Content/fonts/DavidLibre-Bold.ttf',
italic: '/Content/fonts/davidLibre-medium.ttf'
},
chartOptions: {
chart: {
style: {
fontFamily: 'DavidLibre, Tahoma, sans-serif'
}
},
lang: {
decimalPoint: ',',
thousandsSep: '.',
rtl: true
}
}
},
lang: {
decimalPoint: ',',
thousandsSep: '.',
rtl: true
},
chart: {
styledMode: false,
style: {
fontFamily: 'DavidLibre, Tahoma, sans-serif',
direction: 'rtl'
}
},
title: {
useHTML: true
}
};
options.series = {};
var newOptions = $.extend(true, {}, options, additionalSettings);
// Call the original highcharts function with the merged options
return originalHighcharts.call(this, newOptions);
};
The DavidLibre
is for Hebrew font (ttf files).
The pdf is export fine, except that the word עברית
is shown swapped when pdf is exported (תירבע
) in the pdf file.
When the word is a word in English, it is shown OK.
For png files - the export is also fine.
Why pdf show the Hebrew word in reverse order and how to fix that? (without reversing the string itself, since there are also words in English).
Also, I though for adding the character \u200E
before and after the Hebrew string - that do the thing, but it is shown, and maybe another Hebrew font supports this, but what exactly.