Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

[22103] Ensure effective textFont of chunk reports correct value #7192

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

livecodepanos
Copy link
Contributor

No description provided.

@@ -2438,6 +2438,10 @@ void MCField::GetEffectiveTextFontOfCharChunk(MCExecContext& ctxt, uint32_t p_pa

if (r_mixed)
return;

if(!MCStringIsEmpty(*t_value))
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is the check for the non-empty string necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think the effective textFont of a chunk cannot be empty. It *t_value is nil or kMCEmptyString then the effective textFont of a chunk should be the effective textFont of the field (i.e. GetEffectiveTextFont(ctxt, r_value); from above)

Copy link
Contributor

@runrevmark runrevmark Oct 14, 2019

Choose a reason for hiding this comment

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

Okay so - I don't think t_value can be nil :)

The problem here is an incorrect use of the GetCharPropCharChunk method I think... It is being called in 'effective'; mode - so the method should be:

MCAutoStringRef t_default;
GetEffectiveTextFont(ctxt, &t_default);
GetCharPropOfCharChunk< PodFieldPropType<MCStringRef> >(ctxt, this, p_part_id, si, ei, &MCBlock::GetTextFont, true, *t_default, r_mixed, r_value);

Here we are calling them method in question in 'effective' mode, which means it uses t_default as the value to use when a style run has the property unset. Of course, appropriate tests will determine whether this is correct :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have tried this ^^^^ with the sample stack attached to the bug report and for the first line (where its textFont is not set - it is just the textfont of the field that is set) it returns empty for the effective textFont (and r_value is NULL in this case):

Screenshot 2019-10-14 at 12 31 31

@livecodepanos livecodepanos changed the base branch from develop-9.5 to develop November 25, 2019 13:15
@livecodepanos livecodepanos modified the milestones: 9.5.1-rc-1, 9.6.0-dp-1 Nov 25, 2019
@livecodeali livecodeali modified the milestones: 9.6.0-dp-1, 9.6.0-dp-2 Nov 27, 2019
@runrevmark runrevmark added the WIP label Mar 12, 2020
@runrevmark runrevmark removed this from the 9.6.0-dp-2 milestone Mar 12, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants