Jump to content
Server Maintenance This Week. ×

Italic font reverts to a system font


nowshiva

Recommended Posts

  • Newbies

I have labels (for books) that I print out, based on a text field which contains the book details. To properly do this, the name of the book needs to be italicised. But a very strange thing happens. Whatever font I put the field in, the italicised section just reverts to some kind of system font (I guess), doesnt matter what font I change it to. And it also changes the line spacing, for the italicised section. This occurs in preview, and when printing. I have no idea what is going on, or what to do about it. See attached:

Screenshot 2023-10-25 at 6.25.47 am.png

Screenshot 2023-10-25 at 6.25.55 am.png

Link to comment
Share on other sites

1 hour ago, nowshiva said:

it also changes the line spacing

To me it looks more like the title also has its own font size, in addition to being italicized. And possibly its own font too, since you say it refuses to respect the font setting for the field. There could be two reasons for this: 

  1. Apparently this is a calculation field, so you could be overriding the layout settings in the calculation formula;
  2. The title could be stored as formatted text in its original field.

If you could post a small file that demonstrates the problem (and only the problem), it would be much easier to determine the exact cause and prescribe a cure.

 

Link to comment
Share on other sites

So eventually I discovered that the text in your example comes from the Text reference field. If you look at the result of GetAsCSS ( Texts::Text reference ) you will see:

<span style="" >Baum, J. (2022). </span><span style="font-family: 'Verdana';font-style:italic;" >Anxiously Attached : Becoming More Secure in Life and Love</span><span style="" >. Penguin Publishing Group.&#9;</span>

which shows that the title span is hard-wired to the Verdana font at the data level. You don't notice this when viewing the Central layout, because the field there is also formatted to display in Verdana. But on the other layout the default font for the field is Times, so the difference becomes apparent. 

I have added a cTest calculation field to your file that removes the font attribute, and used it in a copy of your label. You can observe the difference it makes in appearance. Eventually you should replace the contents of the original Text reference field with the results of this calculation (make sure you have a backup before you try that).

--
P.S. Next time, please remove everything in your file that's irrelevant to the problem.

 

Learn Gestalt extra 2.fmp12

Link to comment
Share on other sites

I was curious how the problem might have been created and discovered something I didn't know (or perhaps did know at some point and forgot since?):

When you select some text in a field and format it as italic (or bold), the text is tagged not only with the selected style, but also with the font in which it is currently displayed. 

Further research shows that this was already reported as a bug -  but (typically) Claris maintain this behavior is a "feature" and do not intend to change it.


How to work around this bug:
Instead of selecting the text you want to style as italic and then choosing Format>Style>Italic from the menu, select the text and then run the following script step:

Insert Calculated Result [ TextStyleAdd ( Middle ( Get ( ActiveFieldContents ) ; Get ( ActiveSelectionStart ) ; Get ( ActiveSelectionSize ) ) ; Italic ) ]

 

This correctly adds only the font-style attribute to the selected text, without the unwanted font-family.

 

Edited by comment
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.