Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error compiling tests/httpget #153

Open
kaushalmodi opened this issue May 17, 2021 · 1 comment
Open

Error compiling tests/httpget #153

kaushalmodi opened this issue May 17, 2021 · 1 comment

Comments

@kaushalmodi
Copy link

kaushalmodi commented May 17, 2021

Hello,

I followed these steps:

  1. nimble install fidget -> Installed fidget 0.7.7
  2. Cloned this repo, mainly to get the httpget example with the font and the .nims. And then I cd'd to that directory.
  3. nim r httpget.nim

That gave me this error:

Hint: used config file '/home/kmodi/sandbox/nim/fidget/tests/httpget/httpget.nims' [Conf]
/home/kmodi/sandbox/nim/fidget/src/fidget/common.nim(6, 10) Warning: imported and not used: 'typography' [UnusedImport]
/home/kmodi/sandbox/nim/fidget/src/fidget/opengl/base.nim(1, 50) Warning: imported and not used: 'pixie' [UnusedImport]
/home/kmodi/sandbox/nim/fidget/src/fidget/openglbackend.nim(81, 38) Error: ambiguous identifier: 'fonts' -- use one of the following:
  common.fonts: Table[system.string, font.Font]
  @m..@s..@s..@s..@s..@s.nimble@spkgs@spixie-1.2.0@spixie@sfonts.nim.fonts:

$ nim -v
Nim Compiler Version 1.5.1 [Linux: amd64]
Compiled at 2021-01-11
Copyright (c) 2006-2021 by Andreas Rumpf

git hash: fd5c8ef20845a511ad4e0af8dd8ad4331bf46ffc
active boot switches: -d:release

--

PS; I have no experience with UI related code, but I thought of trying out this example after watching your NimConf 2020 video.

I hope this is a quick fix; may be this regression happened after you recently introduced the pixie package?

@kaushalmodi
Copy link
Author

kaushalmodi commented May 17, 2021

This fixed the compilation:

diff --git a/src/fidget/openglbackend.nim b/src/fidget/openglbackend.nim
index 635573b..10cb340 100644
--- a/src/fidget/openglbackend.nim
+++ b/src/fidget/openglbackend.nim
@@ -78,7 +78,7 @@ proc unFocus*(keyboard: Keyboard, node: Node) =
     keyboard.focusNode = nil
 
 proc drawText(node: Node) =
-  if node.textStyle.fontFamily notin fonts:
+  if node.textStyle.fontFamily notin common.fonts:
     quit &"font not found: {node.textStyle.fontFamily}"
 
   var font = fonts[node.textStyle.fontFamily]

But the example still didn't work for me (as I said, I haven't done any UI devel, and so I don't have this openGL library):

Hint: /tmp/kmodi/.cache/nim/httpget_d/httpget  [Exec]
Failed to open window. GL version:3.3

nim js httpget.nim created httpget.js .. Now need to figure out how I run it in the web browser as you show in the video ..


Update: I needed to just create this wrapper HTML

<html>
    <body>
        <script type="text/javascript" src="httpget.js"></script>
    </body>
</html>

The httpget example worked after the above compilation fix.

kaushalmodi added a commit to kaushalmodi-forks/fidget that referenced this issue May 17, 2021
This commit fixes this compilation error when trying to compile one of
the tests: tests/httpget:

    src/fidget/openglbackend.nim(81, 38) Error: ambiguous identifier: 'fonts' -- use one of the following:
      common.fonts: Table[system.string, font.Font]
      @m..@s..@s..@s..@s..@s.nimble@spkgs@spixie-1.2.0@spixie@sfonts.nim.fonts:

Fixes treeform#153 .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant