View Issue Details

IDProjectCategoryView StatusLast Update
0001841NoesisGUIUnitypublic2020-12-03 12:27
Reporterstonstad Assigned Tosfernandez  
PrioritynormalSeveritymajor 
Status resolvedResolutionfixed 
Product Version3.0.7 
Target Version3.0.8Fixed in Version3.0.8 
Summary0001841: NoesisPostProcessor Fails Importing Fonts
Description

I am unable to import the following two fonts within the same project. I tried placing each font in a different directory but it fails.

IOException: Sharing violation on path D:\Source\MBI.CustomerSelect.Unity\MBI.CustomerSelect.Unity.Project\Assets\User Interface\Fonts2\Proforma-SemiBold_36608.ttf
System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.Boolean anonymous, System.IO.FileOptions options) (at <9577ac7a62ef43179789031239ba8798>:0)
System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share) (at <9577ac7a62ef43179789031239ba8798>:0)
(wrapper remoting-invoke-with-check) System.IO.FileStream..ctor(string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare)
System.IO.File.Open (System.String path, System.IO.FileMode mode, System.IO.FileAccess access) (at <9577ac7a62ef43179789031239ba8798>:0)
NoesisPostprocessor.ScanFont (System.String uri, System.Collections.Generic.List1[NoesisFont]& fonts) (at Assets/NoesisGUI/Plugins/Editor/NoesisPostprocessor.cs:188) NoesisPostprocessor+<>c__DisplayClass14_0.<ScanDependencies>b__0 (System.String uri, Noesis.XamlDependencyType type) (at Assets/NoesisGUI/Plugins/Editor/NoesisPostprocessor.cs:263) UnityEngine.Debug:LogException(Exception) <>c__DisplayClass14_0:<ScanDependencies>b__0(String, XamlDependencyType) (at Assets/NoesisGUI/Plugins/Editor/NoesisPostprocessor.cs:280) Noesis.GUI:OnXamlDependency(Int32, IntPtr, Int32) (at Assets/NoesisGUI/Plugins/API/Core/NoesisGUI.cs:420) Noesis.GUI:Noesis_GetXamlDependencies(HandleRef, String, Int32, NoesisXamlDependencyCallback) Noesis.GUI:GetXamlDependencies(Stream, String, XamlDependencyCallback) (at Assets/NoesisGUI/Plugins/API/Core/NoesisGUI.cs:241) NoesisPostprocessor:ScanDependencies(String, List1&, List1&, List1&, List`1&) (at Assets/NoesisGUI/Plugins/Editor/NoesisPostprocessor.cs:251)
NoesisPostprocessor:ImportXaml(String, Boolean, Boolean, Boolean&) (at Assets/NoesisGUI/Plugins/Editor/NoesisPostprocessor.cs:333)
NoesisPostprocessor:ImportXaml(String, Boolean, Boolean, Boolean&) (at Assets/NoesisGUI/Plugins/Editor/NoesisPostprocessor.cs:353)
NoesisPostprocessor:ImportAssets(String[], Boolean, UpdateProgress) (at Assets/NoesisGUI/Plugins/Editor/NoesisPostprocessor.cs:55)
<>c__DisplayClass4_1:<OnPostprocessAllAssets>b__0() (at Assets/NoesisGUI/Plugins/Editor/NoesisPostprocessor.cs:110)
UnityEditor.EditorApplication:Internal_CallUpdateFunctions()

Steps To Reproduce

Add fonts to Unity project w/ Noesis installed.

Encl. AngryFonts.zip

Attached Files
AngryFonts.zip (74,252 bytes)
PlatformAny

Activities

sfernandez

sfernandez

2020-11-20 18:17

manager   ~0006785

Those two .ttf files refer to the same family name "Proforma", but I was able to import them to the Unity project by adding them to different folders.
The error you are getting is originated when a xaml gets imported (I guess using those fonts), could you please share how are you referencing them in the xaml?

sfernandez

sfernandez

2020-11-20 18:32

manager   ~0006786

Just to make it clear, I meant that both ttfs have the same family name and weight (400) so if you import both in the same directory, only the first registered one will be in fact used.
If you edit for example Proforma-Medium.ttf with a program like FontForge to set its Weight to 600 then both fonts can be imported in the same directory and used in xaml by selecting the corresponding FontWeight.

sfernandez

sfernandez

2020-11-23 11:53

manager   ~0006791

I've been doing some tests and I was able to reproduce that "Sharing violation" exception by having the font opened in windows and then reimporting the xaml in Unity.

To fix this I had to change how we open files in NoesisPostprocessor adding "FileShare.Read":

line 188: using (FileStream file = File.Open(font, FileMode.Open, FileAccess.Read, FileShare.Read))
line 248: using (FileStream file = File.Open(filename, FileMode.Open, FileAccess.Read, FileShare.Read))

This should work, could you try it yourself until we release a new version?

stonstad

stonstad

2020-11-24 02:07

reporter   ~0006809

Hi Sergio -- I was referencing both versions like this:

<FontFamily x:Key="Proforma">Fonts/#Proforma</FontFamily>
<FontFamily x:Key="ProformaSemiBold">Fonts2/#Proforma</FontFamily>

The fonts conflicted despite existing in a different directory. To my knowledge, the font was not open in a third-party program other than Unity.

stonstad

stonstad

2020-11-24 02:07

reporter   ~0006810

I'll try your proposed change.

sfernandez

sfernandez

2020-11-26 18:36

manager   ~0006835

Did you try the fix?

Issue History

Date Modified Username Field Change
2020-11-20 18:09 stonstad New Issue
2020-11-20 18:09 stonstad File Added: AngryFonts.zip
2020-11-20 18:12 jsantos Product Version 3.1 => 3.0.7
2020-11-20 18:12 jsantos Target Version => 3.0.8
2020-11-20 18:12 jsantos Description Updated
2020-11-20 18:12 jsantos Steps to Reproduce Updated
2020-11-20 18:17 sfernandez Assigned To => sfernandez
2020-11-20 18:17 sfernandez Status new => feedback
2020-11-20 18:17 sfernandez Note Added: 0006785
2020-11-20 18:32 sfernandez Note Added: 0006786
2020-11-23 11:53 sfernandez Note Added: 0006791
2020-11-24 02:07 stonstad Note Added: 0006809
2020-11-24 02:07 stonstad Status feedback => assigned
2020-11-24 02:07 stonstad Note Added: 0006810
2020-11-26 18:36 jsantos Status assigned => feedback
2020-11-26 18:36 sfernandez Note Added: 0006835
2020-12-03 12:27 sfernandez Status feedback => resolved
2020-12-03 12:27 sfernandez Resolution open => fixed
2020-12-03 12:27 sfernandez Fixed in Version => 3.0.8
2025-10-10 13:29 jsantos Category Unity3D => Unity