Search Unity

  1. Are you interested in providing feedback directly to Unity teams? Sign up to become a member of Unity Pulse, our new product feedback and research community.
    Dismiss Notice

TEXDraw - Create Math Expressions inside Unity!

Discussion in 'Assets and Asset Store' started by WillNode, Jan 13, 2016.

  1. paras2

    paras2

    Joined:
    Jan 26, 2017
    Posts:
    17
    Dear WillNode,

    You cant imagine how much happy your message made me. thank you so much. sorry about my late reply , it was our new year and we were on holiday, this is my first day at work.( Iranian new year) your message made my new year:D
    Listen, this supplement looks wonderful :):):):), but I cant make it work, it cannot be compiled because it doesnt know what TEXSupHelpTip is (I have error compile for this class) and also on TEXSupplementEditor. Is there any other class that I am missing ?

    Thank you so much again.
    Looking forward to hearing from you.

    Many Many Thanks.
     
  2. paras2

    paras2

    Joined:
    Jan 26, 2017
    Posts:
    17
    Dear WillNode,

    I m very sorry that I was out of city when you asked me this question. Konash's work is fine but it doesnt support multiple lines so we preferred the following link
    https://github.com/HamidMoghaddam/unitypersiansupport
    it's not only Arabic, our language is Farsi/Persian which is also supported by Konash's work, the problem with his work is that it doesnt support multi lines and the justification is not right.
    if you make this RTL work with TexDraw , besides the happiness you would bring me, our company would also ready to donate.

    Looking forward to hearing from you ,
    Regard
    Paras2
     
    Last edited: Mar 27, 2017
  3. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    360
    That's made my smile, thank you. And FYI, TEXSupHelpTip is recent addition (Ver 3.3) so you need to upgrade the TEXDraw version to your project.

    Seems logical, I'll integrate with this later on. The justification issue just have been fixed few days earlier but yeah, not stable yet.

    Thank you, but Nah, you already paid for that :D
     
  4. paras2

    paras2

    Joined:
    Jan 26, 2017
    Posts:
    17
    Dear WillNode,
    Thank you so much for the answer. I upgraded to version 3.3 and added Arabic support but still it doesnt work I cannot find the component "TEX Sup RTL Support" tto add to the texDraw box. can you help me please. Attached its a image of the situation I am in.
    thank you again
     

    Attached Files:

  5. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    360
    Well, it works on me. Maybe you need to reimport the patch?

    Screenshot (186).png
     
  6. paras2

    paras2

    Joined:
    Jan 26, 2017
    Posts:
    17
    Dear WillNode,

    Yup , you were right , it worked wonderfully thank you so much.:):):):) Can you help me to fix the multiple line problem ? can you please guide me where should I add the following code :
    https://github.com/HamidMoghaddam/u...aster/UnityPersianSupport/PersianFixer.cs#L57

    We always use this way to fix the justification problem . now that we need to have formula and Persian together I need to add this code to your code. can you kindly let me know where should I add this? ( line 57 is where the justification or handling multiple line is happening).. any help from you is highly appreciated.

    Many Many Thanks
    Paras2
     
  7. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    360
    TEXDraw system is entirely different with Text even we know both of them are using the same UI.

    First, I'm eagerly want to say huge thanks to you because your patience to make TEXDraw supports RTL system --- Three weeks ago.

    Second, Thank you for the link to persian fixer. From the code I understood that the whole thing that make RTL support is a game-changer: Wrapping goes in reverse way. So I spend the whole day implementing this into the very sensitive part in TEXDraw. My brain nearly explodes because of this :rolleyes:. Anyway, I'm telling you that I just finished everything that you ask ;)

    In this patch, I added few more options in wrapping property. I know that not everybody will use it, so you need to enable it via TEXDraw menu (Tools/TEXDraw/RTL Extras/Enable ReversedWrapping integration). Once it is ready, you can try it along with RTL supplement and see if both of them will working each other.

    Screenshot (191).png

    This patch is so stable that I'd planned it to made in V3.4. Have a nice day!
     

    Attached Files:

  8. Vern_Shurtz

    Vern_Shurtz

    Joined:
    Mar 6, 2009
    Posts:
    264
    Hi there,
    I am wanting to add TEXDraw to a Hololens project and I am getting the following build errors after adding the TEXDraw asset.
    Code (CSharp):
    1. Assets\TEXDraw\Core\Internal\TexMetaRenderer.cs(187,39): error CS0117: 'Array' does not contain a definition for 'ConvertAll'
    2.  
    3. Assets\TEXDraw\Core\Internal\TexFormula.cs(64,17): error CS0103: The name 'Console' does not exist in the current context
    Attached is a screenshot of my build settings.

    Any ideas?
     

    Attached Files:

  9. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    360
    Look like VR platforms doesn't support those classes. Luckily two of these errors are meant for debugging purposes so I can get rid of them easily. Try to use this patch and see if it solve the problem.
     

    Attached Files:

  10. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    360
    Oops. I spotted a compiler error on build. I'm reupload the patch.
     

    Attached Files:

  11. paras2

    paras2

    Joined:
    Jan 26, 2017
    Posts:
    17
    Dear WillNode,

    Thank you so much ... I m so sorry that it made your brain to explode:(:confused:. I dont know how to appreciate your effort thank you so much.
    Can I ask you a question o_O( I promise this would not be the same as my requests) : how can I make these two patches work together . I am getting the following error all the time... What should I do ?

    Thank you very much again [hearts]
     

    Attached Files:

    • err1.png
      err1.png
      File size:
      50.7 KB
      Views:
      548
  12. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    360
    Ouch, sorry! my bad. I missed one more file changes in the patch. I'm reuploading the patch again.

    However, if the patch still not work you can check on the asset store if V3.4 just been released in asset store. Yesterday i've submitted it and it should been released in few days.

    No problem, most programmers learnt like that. Anyway i'm saying 'nearly', right? ;)
     

    Attached Files:

  13. Vern_Shurtz

    Vern_Shurtz

    Joined:
    Mar 6, 2009
    Posts:
    264
    Thank you for the patch. I'll give it a test this week.
     
    WillNode likes this.
  14. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    360
    Oh, I nearly forgot that today TEXDraw deserves a seat to 24 Hour sale! Yeah, I'd waiting for that since a year ago.

    EDIT: Bad news that V3.4 didn't make it for the sale in time.
     
  15. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    1,373
    @WillNode
    Can you please provide support for language syntax highlighter?

    For example i want to use your plugin to show C# code snippter, and it should show its syntax highlighted.

    Thanks
     
  16. paras2

    paras2

    Joined:
    Jan 26, 2017
    Posts:
    17
    Unfortunately I couldnt make it work, I got the error that TEXconfiguration does not exist in the current context. Do you have any idea what its about ?
    Also version 3.4 is not up yet...



    :D:D:D

    Thank you again
    Bests
    Paras2
     
  17. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    360
    Whoa! Syntax highlighting is technically possible but... I can't simply do that on my own. Even there's many syntax highlighting APIs out there (like this or this), that's still beyond than two consecutive weeks development.

    So, not yet. Unless that's really important :D

    Hehe, sorry. Too much changes over there. If you request this via email now I'm sure I can send you the whole package ASAP.
     
  18. paras2

    paras2

    Joined:
    Jan 26, 2017
    Posts:
    17
    Thank you for the answer. So shall I have your email address please? Mine is parastoo.mojabi@gmail.com .

    looking forward to hearing from you,
    Best Regards
    Paras2
     
  19. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    360
    I have send the package. It should works by now.
     
  20. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    360
    Yeah, the 24 Hour sale has ended today. I'll miss it so much.
     
  21. paras2

    paras2

    Joined:
    Jan 26, 2017
    Posts:
    17
    Dear WillNode,

    Hope you are fine. Do you have any other solution for adding the image. I need to do this during run time, I dont know what image my user is going to add, I only know the dimensions which is fixed . I was thinking about adding game object to the texDraw in run time . I think I need to know where the blinking cursor is and what is the length of each line in texdraw. Do you have a better solution ?

    Looking forward to hearing from you
    Bests
    Paras2
     
  22. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    360
    It depends on the context on where you place that Image. I mean, do the Image inlined (like emoticon) or placing it large in one line (like images in this forum) or run in multiple lines of text in horizontal side (like other word processor).

    The sprite that already supported here is always inlined (first option). However if you want to ...

    That's the third option. That's would be similar like how popular word processing does, and it is so complex that I'm not doing to add the feature soon.

    Then the image must be outside from TEXDraw. It may can be done easily since we can use \link behaviour to hook up any rectTransform. We'll see later.

    I'm fine, thanks for asking :)
     
    Last edited: Apr 5, 2017
  23. jprocha101

    jprocha101

    Joined:
    Apr 8, 2015
    Posts:
    134
    Hi @WillNode,

    Can Japanese characters be used in this asset?

    I want to try to create ruby text using the \nfrac functionality.
     
  24. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    360
    Yes but I'm not sure how japanese characters are differs from letter.

    Have you tried the demo?
     
  25. jprocha101

    jprocha101

    Joined:
    Apr 8, 2015
    Posts:
    134
    @WillNode
    I was not able to. I get an error when attempting to extract the files.

    upload_2017-4-11_8-12-30.png
     
  26. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    360
    That's strange. According to this you need an external zipper like 7-zip or WinRar. I have compressed that file under 7-zip. I might need to reupload the file later.
     
  27. jprocha101

    jprocha101

    Joined:
    Apr 8, 2015
    Posts:
    134
    I was able to extract with 7 zip, I was using the default Windows compression tool. Thanks for the quick reply!

    Unfortunately I receive an error when attempting to use a Japanese character.

    \nfrac{つぎ}{次}

    upload_2017-4-11_14-17-45.png
     
  28. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    360
    Sorry for that. I have tested japanese characters in both editor & standalone and it is working as it is.

    Screenshot (214).png

    From my test on various history release this has been fixed since V3.3, which I guess the problem with SerializedDictionary.

    The demo above is based on V3.2 so yes, that's the reason. We'll upload again when demo upgrade is done later.
     
    jprocha101 likes this.
  29. jprocha101

    jprocha101

    Joined:
    Apr 8, 2015
    Posts:
    134
    Looks perfect. Thank you so much.
     
  30. jprocha101

    jprocha101

    Joined:
    Apr 8, 2015
    Posts:
    134
    @WillNode - One last question ;)

    Will setting the "Alignment" in the "TEX Draw" component to the bottom pull down the regular text? Resulting in the denominator being vertically aligned with the regular text.

    I could not find any latex commands in the documentation to do this. There might be some in there somewhere, there is a lot of documentation and that is very good thing!

    (from documentation)
    upload_2017-4-12_11-7-51.png

    (from demo)
    upload_2017-4-12_11-7-31.png
     
    Last edited: Apr 12, 2017
  31. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    360
    No.

    Actually the behaviour that you've wanted is like (you can try this in demo) ...

    Code (csharp):
    1. {example}^^{top}
    Unfornately, I just found that it does do the same thing which (by design) isn't expected. I'm already working on the fix. We'll see the news later

    Thank you for the suggestion.
     
    jprocha101 likes this.
  32. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    360
    @jprocha101 I have updated the demo to V3.5 (beta phase). The demo now contains more options and templates for quick preview. The fix for your problem also has been addressed there. And because it is 3.5, the demo contains new expressions which not exist in current version.

    Screenshot (219).png

    The V3.5 update will happen in next days. Stay tuned guys!
     
    jprocha101 likes this.
  33. jprocha101

    jprocha101

    Joined:
    Apr 8, 2015
    Posts:
    134
    Looks good! Purchased and reviewed.

    Note: \nfrac{}{} isn't working in the demo. However using {}^^ has the same functionality and that does work.
     
  34. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    360
    Thank you very much for that. In case if you bit hurry, You can send me an email so I can send this internal version to you.

    o_O Oh, my bad. It is actually working but \n in \nfrac is misinterpreted as new line by a supplement. Good spot though. Should be easy to fix anyway.
     
    Last edited: Jun 28, 2020
  35. BeautifulRiver

    BeautifulRiver

    Joined:
    Sep 19, 2016
    Posts:
    47
    @WillNode, Hi, I just purchased TexDraw and imported to a new project. It reported 10 errors, all basically the same error:
    The name `Profiler' does not exist in the current context
    Can you please help me. Thanks!
     
  36. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    360
    It look like that you're targeting another platform which doesn't support Profiler.###. Yes we use some of them (for debugging reason) but never expect that will happen. which platform that you're targeting at?

    Anyway. I'll make the fix for it. Send a PM to me and I will reply with solved problem once i have finished it.
     
  37. BeautifulRiver

    BeautifulRiver

    Joined:
    Sep 19, 2016
    Posts:
    47
    Thanks for the quick response.

    It seems that adding the following at the top of the file solve the problem.
    using UnityEngine.Profiling;
     
    Last edited: Apr 23, 2017
    WillNode likes this.
  38. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    360
    Ah. You're right. Good spot though, I'm likely stuck on it because i've submit the asset in 5.2.1 so I didn't know that. Idk why it doesn't trigger API updater by the way.
     
  39. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    360
    I'm nearly forgot to tell that V3.5 is already available in the asset store few days ago.

    Numerous cases told me that the package on iPhone 4 was work in V2.7.1 (no longer works since V3.0). This probably the cause in shader part. I'll try to compare and fix the problem.

    But the new problem is I don't even have an iPhone. If anyone here have iPhone 4 and interested, reply here or send me email so you can try it later when I have resolve the problem.
     
  40. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    360
    I just found this release note mentioned in 5.6 is a big deal to UI development in unity.

    Okay then, I'll explicitly state AdditionalShaderProperties in this asset from now. I'm still not sure if this also fixes the rendering issue in iPhone 4.
     
  41. BeautifulRiver

    BeautifulRiver

    Joined:
    Sep 19, 2016
    Posts:
    47
    @WillNode, thanks for the active maintenance and the latest update!

    I want to draw a rounded rectangle as a background and may be a border for the command \bg. I will be happy to try it myself if you can show me which scripts I need to look at and give me any helpful suggestions off the top of your head.
     
  42. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    360
    Thanks but I won't do that :p.

    I have a workaround which is much easier and flexible to do the same behavior just like you want. In V3.6 I have added a new supplement TEXSupLinkAsLayouter which uses generated link coordinates to layout given UIs. You can use that for compositing a lot of buttons with custom images.

    Screenshot (334).png

    I have enhanced its behaviour little much better so I upload it here. It belongs to Assets\TEXDraw\Script\Supplements.
     

    Attached Files:

  43. BeautifulRiver

    BeautifulRiver

    Joined:
    Sep 19, 2016
    Posts:
    47
    @WillNode, Thanks again for the fast and very helpful response. :D

    I actually don't think the rounded-rectangle background should be part of the \bg command. There'll be too many parameters and variations to specify such generalizations. Uncontrolled generalizations would eventually lead to messy TEXDraw API's and a nightmare to maintain. So I agree with you that you don't want to do it ;) I am not suggesting you to provide such feature in your TEXDraw, I want to specialize my own copy of TEXDraw. Your picture and update is very helpful.

    Your suggested approach is insightful. I can embed TEXDraw as a child of a Image (as a background). My followup question is how to find the position and dimension of the bounding box of a TEXDraw at runtime, so I can create a background image of the right size to fit the math formula. Do you have an API for that. It seems such an API would be very useful for customization. Or may be suggest where to look for this info in your script (perhaps where you draw the box for \bg).
     
    Last edited: May 8, 2017
  44. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    360
    Okay. I might need to broaden that little a while...

    The bounding box of TEXDraw is exactly the same with RectTransform.rect. In the TEXSupLinkAsLayouter.cs file there is a function GetWorldRect() to transform that "local" rect coordinate into world/canvas rect.

    If you talking about get a local coordinate of specific expression then we going for the technical part. TEXDraw's rendering system is split into three phases. What you're looking for is second phase, where coordinates is calculated and determined. This phase is called "Boxing" and its cached version is contained in TEXDraw.drawingParams.parsed (also it's public).

    Screenshot (336).png

    This parameter is containing arrays of Boxes per paragraph. One box has width/height parameters and also can contain childrens of boxes and so on. It branched like trees so no, you can't have any way or clue to which position in string is regarding to because that information is lost in first phase to simplify things. This is also the reason why Text Input is never be available to TEXDraw. You can see how it constructed via debugging but no, you basically can't do anything with it.

    Yep, It still impossible to do without changing the internal part o_O
     
  45. BeautifulRiver

    BeautifulRiver

    Joined:
    Sep 19, 2016
    Posts:
    47
    texdraw-explain.png

    @WillNode Thanks for the clarification, it will take me some time to fully digest your comments. In the mean time, I'll explain my objective with a picture.

    The RectTransform.rect is going to be fixed in my application, hence of no use. The formula changes in real-time, I have no control of how tall/long the formula in run-time. Hence I need a way to find the best-fit bounding box.

    I do not need the best-fit bounding box for partial math formula. Is it easier to get the bounding box for the whole thing, the whole contents of whatever inside the TEXDraw? In other words, I want to know the position and box of the \bg command for the whole math expression.

    Or may be you have a entirely different and/or better approach to solve my problem? Thanks again for your helpful insight!
     
    Last edited: May 8, 2017
  46. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    360
    @BeautifulRiver OK, thanks for the clearing up. It's very clear now.

    There are two ways about how to get the bounding box easily. First is \link which I had explained before or crawl and go make the script instead.

    Luckily for you TEXDraw have already doing that job and it's saved in drawingParams.offset and drawingParams.size. Combined together both of them produced a local coordinate of exact bounding box which is what you want.

    I managed to create a simple script to validate my hypothesis.

    Screenshot (337).png
     

    Attached Files:

  47. BeautifulRiver

    BeautifulRiver

    Joined:
    Sep 19, 2016
    Posts:
    47
    @WillNode, Your example works beautifully!
    Unfortunately, when I put it in the script S_03 (attached to the canvas), it always gives me 0,0 for position and 0,0 for size at run-time. It did print the TEXdraw's text property correct ly. Same result in the Update method.
    texdraw-explain-2.png
     
    Last edited: May 8, 2017
  48. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    360
    @BeautifulRiver

    The problem is that you trying to Access the API at Start() function which TEXDraw even doesn't start the rendering yet. This gives result of 0x0.

    If you want to get a callback then you have to this in Update() just exactly how TEXSupLinkAsLayouter does.
     
  49. BeautifulRiver

    BeautifulRiver

    Joined:
    Sep 19, 2016
    Posts:
    47
    @WillNode I did try to put the code in Update() as I indicated. The result is still zero. Turns out I have to wait at least one Update(), the output looks correct after 2nd Update().

    Thanks for your fast and insightful response!
    TEXDraw should be rated at least 6 out of 5 stars! :)
     
    jprocha101 and WillNode like this.
  50. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    360
    Okay. V3.7 just available in asset store. I don't know why it took nearly a week to be released.

    Still mostly contain about bug fixes but it probably the most stable version that I have released. The docs and demo online also has been updated too.
     
unityunity