-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Set text baseline conditionally by browser. #3370
Conversation
@dstein64 Great styling, how did you do that? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was the cutoff in that image generated using this branch? I'm unable to reproduce truncated text when using the update from this PR.
Changing |
Sorry about the delay, option 2; ideographic is fine but any uses of bottom need to switch to top. |
Based on the information on https://www.w3schools.com/Tags/canvas_textbaseline.asp, changing Also on the same page, it mentioned:
|
Late response, but the screenshot above repro for me again:
|
Thanks for the details @Tyriar! I'm still not able to reproduce what you're encountering when using this branch. I loaded this branch using Firefox 93 on Windows 11. I then ran On the demo page, I typed text and did not encounter any truncated characters. I then incorporated the latest changes upstream (now force-pushed to this branch), and still don't encounter the issue. In the example screenshot you posted, it looks like you've loaded |
I just ran the demo, not sure why your demo isn't using the real backend which should connect to cmd.exe. Maybe you're missing deps to compile node-pty? But anyway, I doubt that would cause changes in rendering. |
I was using Firefox on Windows as a client for the demo, but the server was running on Linux. I just tried running the demo directly from Windows, following the instructions here, but I'm encountering the following error when running
Earlier in the output is another error:
Full OutputC:\Users\dan\xterm.js>yarn yarn install v1.22.15 [1/4] Resolving packages... [2/4] Fetching packages... info [email protected]: The platform "win32" is incompatible with this module. info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation. [3/4] Linking dependencies... [4/4] Building fresh packages... [1/3] ⡀ node-pty [-/3] ⢀ waiting... error C:\Users\dan\xterm.js\node_modules\node-pty: Command failed. Exit code: 1 Command: node scripts/install.js Arguments: Directory: C:\Users\dan\xterm.js\node_modules\node-pty Output: C:\Users\dan\xterm.js\node_modules\node-pty>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "" rebuild ) gyp info it worked if it ends with ok gyp info using [email protected] gyp info using [email protected] | win32 | x64 gyp info find Python using Python version 3.9.7 found at "C:\Users\dan\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\python.exe" gyp info find VS using VS2019 (16.11.31729.503) found at: gyp info find VS "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community" gyp info find VS run with --verbose for detailed information gyp info spawn C:\Users\dan\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\python.exe gyp info spawn args [ gyp info spawn args 'C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\gyp\\gyp_main.py', gyp info spawn args 'binding.gyp', gyp info spawn args '-f', gyp info spawn args 'msvs', gyp info spawn args '-I', gyp info spawn args 'C:\\Users\\dan\\xterm.js\\node_modules\\node-pty\\build\\config.gypi', gyp info spawn args '-I', gyp info spawn args 'C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\addon.gypi', gyp info spawn args '-I', gyp info spawn args 'C:\\Users\\dan\\AppData\\Local\\node-gyp\\Cache\\17.0.0\\include\\node\\common.gypi', gyp info spawn args '-Dlibrary=shared_library', gyp info spawn args '-Dvisibility=default', gyp info spawn args '-Dnode_root_dir=C:\\Users\\dan\\AppData\\Local\\node-gyp\\Cache\\17.0.0', gyp info spawn args '-Dnode_gyp_dir=C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp', gyp info spawn args '-Dnode_lib_file=C:\\\\Users\\\\dan\\\\AppData\\\\Local\\\\node-gyp\\\\Cache\\\\17.0.0\\\\<(target_arch)\\\\node.lib', gyp info spawn args '-Dmodule_root_dir=C:\\Users\\dan\\xterm.js\\node_modules\\node-pty', gyp info spawn args '-Dnode_engine=v8', gyp info spawn args '--depth=.', gyp info spawn args '--no-parallel', gyp info spawn args '--generator-output', gyp info spawn args 'C:\\Users\\dan\\xterm.js\\node_modules\\node-pty\\build', gyp info spawn args '-Goutput_dir=.' gyp info spawn args ] gyp info spawn C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe gyp info spawn args [ gyp info spawn args 'build/binding.sln', gyp info spawn args '/clp:Verbosity=minimal', gyp info spawn args '/nologo', gyp info spawn args '/p:Configuration=Release;Platform=x64' gyp info spawn args ] Building the projects in this solution one at a time. To enable parallel build, please add the "-m" switch. conpty.cc C:\Users\dan\AppData\Local\node-gyp\Cache\17.0.0\include\node\v8-persistent-handle.h(10,10): fatal error C1083: Cannot open include file: 'v8-weak-callback-info.h': No such file or directory [C:\Users\dan\xterm.js\node_modules\node-pty\build\conpty.vcxproj] conpty_console_list.cc C:\Users\dan\AppData\Local\node-gyp\Cache\17.0.0\include\node\v8-persistent-handle.h(10,10): fatal error C1083: Cannot open include file: 'v8-weak-callback-info.h': No such file or directory [C:\Users\dan\xterm.js\node_modules\node-pty\build\conpty_console_list.vcxproj] Agent.cc AgentCreateDesktop.cc ConsoleFont.cc ConsoleInput.cc ConsoleInputReencoding.cc ConsoleLine.cc DebugShowInput.cc DefaultInputMap.cc EventLoop.cc InputMap.cc LargeConsoleRead.cc NamedPipe.cc Scraper.cc Terminal.cc Win32Console.cc Win32ConsoleBuffer.cc main.cc BackgroundDesktop.cc Buffer.cc DebugClient.cc GenRandom.cc OwnedHandle.cc StringUtil.cc WindowsSecurity.cc WindowsVersion.cc WinptyAssert.cc WinptyException.cc WinptyVersion.cc win_delay_load_hook.cc Generating code Previous IPDB not found, fall back to full compilation. C:\Users\dan\xterm.js\node_modules\node-pty\deps\winpty\src\agent\Agent.cc(231): warning C4722: 'Agent::~Agent': destructor never returns, potential memory leak [C:\Users\dan\xterm.js\node_modules\node-pty\build\deps\winpty\src\winpty-agent.vcxproj] All 1772 functions were compiled because no usable IPDB/IOBJ from previous compilation was found. Finished generating code winpty-agent.vcxproj -> C:\Users\dan\xterm.js\node_modules\node-pty\build\Release\\winpty-agent.exe AgentLocation.cc winpty.cc BackgroundDesktop.cc Buffer.cc DebugClient.cc GenRandom.cc OwnedHandle.cc StringUtil.cc WindowsSecurity.cc WindowsVersion.cc WinptyAssert.cc WinptyException.cc WinptyVersion.cc win_delay_load_hook.cc Creating library C:\Users\dan\xterm.js\node_modules\node-pty\build\Release\winpty.lib and object C:\Users\dan\xterm.js\node_modules\node-pty\build\Release\winpty.exp Generating code Previous IPDB not found, fall back to full compilation. All 1056 functions were compiled because no usable IPDB/IOBJ from previous compilation was found. Finished generating code winpty.vcxproj -> C:\Users\dan\xterm.js\node_modules\node-pty\build\Release\\winpty.dll gyp ERR! build error gyp ERR! stack Error: `C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe` failed with exit code: 1 gyp ERR! stack at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:194:23) gyp ERR! stack at ChildProcess.emit (node:events:390:28) gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12) gyp ERR! System Windows_NT 10.0.19043 gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" gyp ERR! cwd C:\Users\dan\xterm.js\node_modules\node-pty gyp ERR! node -v v17.0.0 gyp ERR! node-gyp -v v8.2.0 |
I was able to get the xterm.js demo running directly from Windows. The problem mentioned in my last comment was from using Node With the demo running directly from Windows, using the branch from this PR, I was still unable to reproduce the cutoff. Next, I ran |
Which could be the expected result, since Also, based on the information provided by this little demo (that I grabbed from W3CSchool website, thanks!), the cutoff problem in this screenshot looked like it was actually caused by the If you visit the demo with Chrome, you'll found that So my guess is, the solution of changing |
Here are the images from @nirui's demo. Chrome Firefox The difference across browsers for
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @Tyriar! I just noticed in my original comment from June that with The issue was not present with I just tried again using |
@dstein64 It seems that the two screenshot in the last comment was captured in different screen resolutions? If you encounter this problem again in the future, can you do more tests (for example changing the font size)? Maybe that will make the "_" symbol pop up somehow (And if it did, maybe something else is at play, not just Sorry for been annoying, I would try these myself but I'm stuck at |
@nirui, the difference in screen resolution was due to me zooming in my browser when capturing the first image, to make it easier to draw a rectangle when creating a screenshot for a region of the screen. I had unintentionally not done that for the more recent capture. At the zoomed-in resolution, the underscore currently appears. That is, zooming-in doesn't have an effect on whether the underscore is out-of-bounds.
It appears that the out-of-bounds underscore was addressed in #3426. I've confirmed that under the scenario with |
When you zoom the underscore might get spread across multiple pixels and we only expand to the first pixel with content which could be very faint. That might have been the problem. Zooming the page will lead to worse rendering in general. |
This changes the
textBaseline
fromideographic
tobottom
for Firefox, to resolve Issue #3353. I made changes in all places wheremiddle
was changed toideographic
as part of PR #3279. The change was not made for Chrome, to avoid Powerline fonts from becoming slightly unaligned. On Firefox, it appears the Poweline text is slightly high when I set the font tomonospace
and slightly low when I set it toDejaVu Sans Mono
, but in both cases an improvement versus the low/truncated text when usingideographic
fortextBaseline
prior to this PR's update, as the text is no longer truncated and the Powerline text is closer to vertically centered alignment.Firefox
fontFamily=monospace
textBaseline=ideographic
(before this PR's update)Firefox
fontFamily=monospace
textBaseline=bottom
(after this PR's update)Firefox
fontFamily=DejaVu Sans Mono
textBaseline=ideographic
(before this PR's update)Firefox
fontFamily=DejaVu Sans Mono
textBaseline=bottom
(after this PR's update)In my testing, the update worked as expected (other than the possible slight Powerline alignment issue mentioned above). However, I don't know whether there are assumptions elsewhere that this would break, and I wasn't sure where in the code would be an appropriate place for defining
TEXT_BASELINE
, which is currently inbrowser/renderer/atlas/Constants.ts
.Any feedback would be appreciated if this is a sufficient way to address Issue #3353 and there is further testing I should conduct and/or additional changes that should be made.