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

FEAT: view's size-string function for measuring text without face object #4218

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

loziniak
Copy link
Contributor

@loziniak loziniak commented Jan 2, 2020

An attempt to deal with #4179.
I had problems with merging master into #4182. Now it's done on a separate branch.

Copy link
Contributor

@qtxie qtxie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR is OK for Windows backend.

]
pair: as red-pair! stack/arguments
pair/header: TYPE_PAIR
gui/get-text-size null text hFont pair
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gui/get-text-size cannot handle null face on Non-Windows platforms.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks! working on it.

@loziniak
Copy link
Contributor Author

I've tried to fix the issues and update the code for latest master. Unfortunately, there is a bug I cannot track down. With debug prints from commit 65befea, I get this under Linux, after compiling console-view in release mode:

% ./console-view__size-string
--== Red 0.6.4 ==-- 
Type HELP for starting information. 

>> size-string probe make font! [size: 20] "–––.."
make object! [
    name: none
    size: 20
    style: none
    angle: 0
    color: none
    anti-alias?: false
    shadow: none
    state: none
    parent: none
]

Hex dump from: 08805624h

08805624: 00000025 F7F24F84  000001C0 F7F24EB4  %...?O????..?N??
08805634: 00000007 00000000  F7F24F94 00000000  ?.......?O??....
08805644: 00000020 F7F24F84  000001C0 F7F24EB4   ...?O????..?N??
08805654: 00000005 00000000  F7F39180 00000000  ?.......????....
08805664: 00000005 00000000  F7F3911C 00000000  ?.......????....
08805674: 0000000B F7F41884  00000014 000008AE  ?...?????...??..
08805684: 0000000B F7F41884  00000014 000008AE  ?...?????...??..
08805694: 00000003 00000000  00000000 00000000  ?...............
font type1: 37 ptr: 08805624 val: 37
font type: 37
null-hfont 2
== 29x17

I don't understand why I get 37 (which is TYPE_PAIR) as a TYPE_OF(font). Any ideas?

@qtxie qtxie force-pushed the master branch 3 times, most recently from 1ec06cd to 7218fb4 Compare October 7, 2021 11:57
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 this pull request may close these issues.

None yet

3 participants