Page 1 of 1

noesis RichText [img] doen't work

Posted: 15 Dec 2023, 08:39
by aliagha.huseynli
Hi,

I read the documentation you prepared
https://www.noesisengine.com/docs/App.A ... hText.html
everything works unless
[img][/img]
still raises the error invalid URL, but I tried many possibilities such as:
[img]Myimage.png[/img]
[img]Assets/Images/Myimage.png[/img]
[img]Images/Myimage.png[/img]
[img]MenuView/Myimage.png[/img]
It doesn't work

Blend error:
Error	XDG0010	Invalid URI: The format of the URI could not be determined
Unity error(this happens when I add link inside img /img. not in local image file):
 [NOESIS/E] Image not found '/cdn-cgi/image/w=1000,fit=contain,q=90,f=auto/library/content/images/size/w600/2023/10/free-images.jpg'
If I write weburl between img link shown in Blend side but it raises error in Unity side

Re: noesis RichText [img] doen't work

Posted: 16 Dec 2023, 13:01
by dengfan
屏幕截图 2023-12-16 200038.png
try add this line.

Re: noesis RichText [img] doen't work

Posted: 17 Dec 2023, 13:05
by aliagha.huseynli
Where should I add this line? Could you please be more specific about what I should do to fix this issue?

Re: noesis RichText [img] doen't work

Posted: 17 Dec 2023, 13:15
by dengfan
I use the native sdk, It may not be quite the same as yours.
Look at bottom of this topic viewtopic.php?t=3145

Re: noesis RichText [img] doen't work

Posted: 18 Dec 2023, 06:35
by aliagha.huseynli
No, unfortunately, it is not what I am facing. I said RichText works. I can see bold italic style changing color. Even weblink url text works. But I am unable to add local image file.
I follow the documentation. It says url invalid for img /img.

Re: noesis RichText [img] doen't work

Posted: 18 Dec 2023, 07:41
by dengfan
I've tried, you just initialize noesis as required, you can display the local image in bbcode.
Ptr<XamlProvider> xamlProvider = ...;
Ptr<LocalFontProvider> myFontProvider = ...;
Ptr<LocalTextureProvider> myTextureProvider = MakePtr<LocalTextureProvider>(".");
NoesisApp::SetThemeProviders(xamlProvider, myFontProvider, myTextureProvider);

Re: noesis RichText [img] doen't work

Posted: 18 Dec 2023, 11:33
by jsantos
It seems the problem is that in Unity, rich text is not adding dependencies to the images it uses. For now, the workaround is manually registering these dependencies, as explained in the Unity tutorial.

Re: noesis RichText [img] doen't work

Posted: 19 Dec 2023, 13:57
by aliagha.huseynli
I read this https://www.noesisengine.com/docs/App.A ... hText.html
The problem is not Unity for my first example.
As I said in this code everything works except img:
<Grid
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:noesis="clr-namespace:NoesisGUIExtensions;assembly=Noesis.GUI.Extensions">
  <TextBlock noesis:RichText.Text="Plain. [b]Bold, [i]bold italic, [/i]
    [size=60]Size 60 text.[/size] [color=Red]Red text.[/color] [img height=80]disk.png[/img]
    [br/] [url='https://www.noesisengine.com/']NoesisEngine.com[/url]" />
</Grid>
I know I should add myLocalImage.png. When I delete
[img height=80]ANYIMAGEFILE.png[/img]
it works fine. I can see bold italic red so on.
I even tried many paths for my .png file. It doesn't work. Error code I shared in the first post.
(I see this error in Blend not in Unity, my Unity error is different check the first post please)

Anyway, I fixed my issue, I used only textblock's Run and InlineUIContainer. But it would be better I could use noesis richtext

Re: noesis RichText [img] doen't work

Posted: 19 Dec 2023, 19:24
by jsantos
There is a limitation (not well documented) with RichText. The tag [img] requires absolute URIs (eg: Assets/Samples/NoesisGUI/3.2.2/Localization/Flag-en.png). With this and manually registering the dependencies in the XAML, this should work.

Please, create a ticket to see if we can improve the implementation to be more flexible.