-
-
Notifications
You must be signed in to change notification settings - Fork 344
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
format_set_font_name does not work for Persian font. #468
Comments
The APIs you need are void format_set_font_family(lxw_format *format, uint8_t value);
void format_set_font_charset(lxw_format *format, uint8_t value); They are public, just not documented because they are rarely required. |
Thanks for replying. I actually tried these two methods and didn't work. I also open the excel file as a zip file and didn't see the changes to charset and font family. |
My bad. I hadn't added the code to use Here is an example: #include "xlsxwriter.h"
int main()
{
lxw_workbook *workbook = workbook_new("gh468.xlsx");
lxw_worksheet *worksheet = workbook_add_worksheet(workbook, NULL);
/* Set the cell size for clarity. */
worksheet_set_column(worksheet, 0, 0, 60, NULL);
worksheet_set_row(worksheet, 0, 100, NULL);
/* Add a format with a font that supports Persian. */
lxw_format *format = workbook_add_format(workbook);
format_set_font_name(format, "B Titr");
format_set_font_size(format, 72);
format_set_font_charset(format, 178);
format_set_font_family(format, 0);
format_set_bold(format);
format_set_align(format, LXW_ALIGN_CENTER);
format_set_align(format, LXW_ALIGN_VERTICAL_CENTER);
/* Write a test string. */
worksheet_write_string(worksheet, 0, 0, "سلام 100000", format);
workbook_close(workbook);
return 0;
} Output: Does that look correct? |
I'm a newbie. Would it work if I download the library using vcpkg ? |
I can wrap it up into a vcpkg but it will take a few days. |
Is version 1.1.9 has the new changes in vcpkg? |
No. Not yet. |
I have been trying "Using CMake for Microsoft Visual Studio" in this tutorial for a week and I always get " |
I have submitted a request to include the updated version, v1.2.0, in vcpkg: microsoft/vcpkg#43758 |
These changes are now upstream in vcpkg libxlsxwriter package version 1.2.0. Could you test that and let me know if is fixed. Thanks. |
The last version still is 1.1.9 in vcpkg. |
I don't know how long it takes to become available. The upgrade patch was merged upstream yesterday. |
My problem also happend in Rust lang and setting font_charset to 178 and font_family to 0 fix my problem. I don't know how to do the same thing in your library. I'm using "B Nazanin" and "B titr" fonts.
jmcnamara/rust_xlsxwriter#125
The text was updated successfully, but these errors were encountered: