cart: empty [ Login ]

Font entity problems

1 
Pavel
7/27/2018 1:22 PM
We use CadLib to convert DXFs/DWGs to our proprietary format. It works fine, mostly. We have one strange issue with the text object processing. CadLib throws the exception in our windows service app (running under the LocalSystem account) System.Exception: Error: DxfReadError, for objects Position = line 3131 (type: String) ---> System.UnauthorizedAccessException: Access to the path 'C:\Windows\system32\config\systemprofile\AppData\Local\Microsoft\Windows\INetCache\Content.IE5' is denied. at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.FileSystemEnumerableIterator`1.AddSearchableDirsToStack(SearchData localSearchData) at System.IO.FileSystemEnumerableIterator`1.MoveNext() at WW.Cad.Model.FontFromDirectoryFileLoader.GetFullFileName(String directory, String fontFilename, SearchOption searchOption) at WW.Cad.Model.FontFromCurrentDirectoryFileLoader.Exists(String fontFilename) at ..?(String filename, IList`1 fileLoaders) at WW.Cad.Model.Entities.ShxFile.(String filename, IList`1 fileLoaders) at WW.Cad.Model.Entities.ShxFile.Exists(String filename, IList`1 path) at WW.Cad.IO.DxfReader.??(DxfTextStyle textStyle) at WW.Cad.IO.DxfReader.??() at WW.Cad.IO.DxfReader.??() at WW.Cad.IO.DxfReader.Read(DxfModel dxfModel) --- End of inner exception stack trace --- at WW.Cad.IO.DxfReader.Read(DxfModel dxfModel) at WW.Cad.IO.DxfReader.Read() at ... our code. Why is that? DXF's file and app locations are not related to .../Content.IE5 directory. We do not convert text entities, but we get this error while enumerating all model entities. We've successfully fixed this error by putting concrete SHX font file (ltypeshp.shx in out case) in our fonts directory. But this is an inconvenient approach since we need to know the exact font to use (our DXF files are coming from different sources). The fallback shx font doesn't help. Here is how we use it (as you can see - we are trying to disable undesired font lookups here): public static void SetupFontLookup(string shxFontLookupDirectory, string fallbackShxFontName) { DxfModel.ClearShxFontFileLoaders(); DxfModel.GlobalShxFontFileLoaders.Clear(); var defaultFontLoader = new FontFromDirectoryFileLoader(shxFontLookupDirectory, SearchOption.AllDirectories); DxfModel.GlobalShxFontFileLoaders.Add(defaultFontLoader); DxfModel.AddShxFontFileLoaders(new[] { defaultFontLoader }); DxfModel.AddShxLookupDirectories(new[] { shxFontLookupDirectory }); if (!string.IsNullOrEmpty(fallbackShxFontName)) { DxfModel.FallbackShxFont = fallbackShxFontName; } } Example DXF is attached. Thanks in advance! Best regards, Pavel
Wout
7/27/2018 1:31 PM
Which CadLib version are you using? I've fixed a problem which looks the same in version 4.0.38.80. The font loading was redesigned to support .NET Standard/.NET Core, but there was a problem in one of the .NET framework calls to search for a file when the user doesn't have access to a directory. - Wout
Pavel
7/27/2018 1:33 PM
WW.Cad.dll, Version=4.0.38.73
Wout
7/27/2018 1:34 PM
Ok, can you download the latest version and try that? - Wout
Pavel
7/27/2018 2:00 PM
Sure, I will try. Thanks.
1