From 606419088de257fe6cfbae16582df0706a48c01a Mon Sep 17 00:00:00 2001 From: Joos Kiener Date: Thu, 2 Nov 2023 13:40:34 +0100 Subject: [PATCH] added info logging when setting platform of fonttable to Windows when running on linux --- pycdxml/cdxml_converter/chemdraw_types.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pycdxml/cdxml_converter/chemdraw_types.py b/pycdxml/cdxml_converter/chemdraw_types.py index 3c8e95d..ebf3812 100644 --- a/pycdxml/cdxml_converter/chemdraw_types.py +++ b/pycdxml/cdxml_converter/chemdraw_types.py @@ -102,7 +102,7 @@ def from_bytes(property_bytes: bytes, charset='iso-8859-1', fonttable=None) -> ' # In that case get_charset will be off by 2 bytes and determine a font id which does not exist in the # document. hence we catch that here and re-read bytes assuming no style runs at all + ascii charset # I have only observed this in newer files from ChemDraw 21. - # Potential issue: if the byte offset happens to by accident lead to a valid font, the problem will + # Potential issue: if the byte offset happens to lead by accident to a valid font, the problem will # emerge somewhere else (possibly only after visual inspection of the file). this is however unlikley to happen # as font_ids usually are around 1-10 which happen to be ASCII control characters unlikely to be at the # start of a string @@ -367,6 +367,7 @@ def from_element(fonttable: ET.Element) -> 'CDXFontTable': os_type = CDXFontTable.PLATFORM_MAC else: # running on linux / not supported -> set to windows + logger.info("Detected Linux OS. Setting cdx file platform type to default of 'Windows'.") os_type = CDXFontTable.PLATFORM_WINDOWS return CDXFontTable(os_type, fonts)