Jump to content
zkarj

Applying paragraph style to text with existing character styles

Recommended Posts

What I am trying to do is paste rich text into my Publisher document and then apply my body style without losing italic and bold text.

If I paste in rich text, it always seems to appear in Helvetica with [No Style] for Paragraph and Character styles. The text does still contain bold and italicised words.

If I then select the whole passage of text and apply, say, Palatino font, the font is switched as expected and the bold and italics remain in force.

If I select the whole passage of text and apply my Body style, the font also changes to Palatino (because that's in the style) but the bold and italic words are forced back to regular.

I tried bringing up my Body style in the style editor and noticed the setting highlighted below.I set that to [No change] but that does not remove the "Italic: Off" in the style description, and when I commit that change and then return to the editor, it once again says "Regular" in the dropdown. I suspect this is a bug in that setting [No change] should remove the "Italic:" entry altogether yet it doesn't.

I assume the Font weight: Normal setting is what is getting rid of the bold text, but I am unclear on why this cannot be changed in the style editor. 

 

Screen Shot 2020-06-16 at 14.59.06.png

Share this post


Link to post
Share on other sites
5 hours ago, zkarj said:

What I am trying to do is paste rich text into my Publisher document and then apply my body style without losing italic and bold text.

I suggest to create Italic and Bold Character Styles (and any other Character Styles that you want to preserve).

Then search for italics, bolds in your text using Find & Replace command in Affinity Publisher and replace them with Italic, Bold Character Styles.

Once you do that you can then start applying your Paragraph Styles to your text and all your italic and bold instances will be preserved.

You can then redefine your Character and Paragraph Styles as you wish.

Regards

Share this post


Link to post
Share on other sites
Posted (edited)
1 hour ago, Gabe said:

Hi @zkarj,

What is your style "based on"? 

Where [no change] is shown, an attribute remains unchanged from the "Based on" style.

Ahhhh! It's based on "Base" which has Font traits: Regular set. That explains the result of the style, but surely the style definition for Body should retain the [No change] in itself? And in fact Base itself exhibits this same behaviour. It is based on [No style] and if I set the Font traits to [No change] it reverts itself to Regular. So aside from the proper inheritance on the page, the style definition still seems to be incorrect in that neither will take [No change] as a value and keep it.

I can find other styles that have [No change] set for Font trait, but all are greyed out and I don't understand why.

I also tried the Apply Style and Preserve ... options, but they do not change the font from the default Helvetica. I can't see a way out of this if I cannot force Base or Body to leave italics and bold alone. Short of burning these styles down to the ground and building up new ones — but I didn't build them, I inherited them from somewhere (I think they are defaults?)

I am familiar with @Seneca's workaround but that seems like a lot of work when the styles should be able to respect the original local formatting.

Edited by zkarj
Clarity.

Share this post


Link to post
Share on other sites
9 hours ago, Seneca said:

This should not take longer than 2 minutes.

Sure, but it's a cognitive load, and it has to be remembered every time I paste text, and let's not forget search and replace cannot currently be scoped so I have to be careful about this action. Anyway, I don't believe this should be necessary, so I'm pushing for a proper solution.

1 hour ago, Wosven said:

[No change] means the style will keep the propriety of its parent style, not that it will keep local formatting.

I understand that but why is it impossible to set [No change] on either Base or Body? If this is by design, that means it is not possible to apply a paragraph style over local formatting while retaining the latter. That seems wrong, and this is supported by the option to "Apply style while keeping local formatting". The trouble with that option is it also does not apply the font, which I also do not understand. I had previously contacted the vendor of the software I am copying from asking why rich text automatically came with the Helvetica font applied and they have responded that it doesn't. 

Either there is something at play that I am missing (why does setting Font Trait: [No change] not persist?) or there are bugs in this area. I believe it should be possible to apply my Body style while keeping the original rich text attributes as local formatting. So far it seems impossible.

Share this post


Link to post
Share on other sites

There's always a "default" style. In AD, AP and APub it's Arial, 12 pt, Space before: 12 pt, etc.

This means that when you past some text in those apps, in a blink document, it's with those attributes (but that's not a style) until you modify or apply a style.

If you don't want to do too much replacements, paste all you text before replacing with character styles.

Share this post


Link to post
Share on other sites

I should clarify one thing — the title of this thread should use the word "local" not "character". I am not applying Character Styles at any point in this troubleshooting. I copy rich text from a Markdown document in Ulysses, and paste it into Publisher. That gives me Helvetica text with bold and italic phrases. All I want to do is apply my Body style without losing the bold and italic. I believe that should be possible, but I cannot figure out how.

The Ulysses support people commented that applying a font that does not have Bold and Italic variants will strip the formatting, but if I apply my Palatino just as a font then the formatting is preserved. It is only when applying my Body style that they disappear.

Share this post


Link to post
Share on other sites
59 minutes ago, zkarj said:

It is only when applying my Body style that they disappear.

This should be simple.

Did you try to use the following command?

Apply "Your Style" to Paragraphs and Preserve Character Formatting.

Right-mouse click on your paragraph style to get these option:

1223463297_Screenshot2020-06-16at23_10_37.png.377c64bcb3d064582e872bb22d5e6d0f.png

Share this post


Link to post
Share on other sites
Just now, Seneca said:

This should be simple.

 

I agree. Yes, I tried all of those options. None of them work. Both "Preserve" options do indeed retain the bold and italic phrases, but neither changes the font. This is why I initially contacted Ulysses support, believing the pasted rich text was specifically tagged with the Helvetica font. They say it's not. I don't know how to verify that.

Share this post


Link to post
Share on other sites
18 hours ago, Wosven said:

[No change] means the style will keep the propriety of its parent style, not that it will keep local formatting.

This is not entirely accurate. If a particular attribute is set to [No change] in a style and in all styles it depends on, then when you apply that style to a text selection, that particular attribute will not be changed from its initial value. In this way, you can actually define styles to preserve italic and bold settings when applying the style.

In fact, that appears to be just what the original poster is asking for, so here is a demonstration file. Open it, notice the bold and italic text in the paragraph, and then apply the paragraph style "Blue Paragraph" to it. The bold and italic are preserved even as the style is applied. Notice how the Base Text and Blue Paragraph styles are set up. The key elements to look for in both styles are the "Font Traits," "Font Weight" and "Italic" settings, all of them in the Font section of the text style editor.

(As for me, I still prefer to explicitly set character styles for such things rather than use local formatting.)

no_change_in_base_styles.afpub

Share this post


Link to post
Share on other sites
15 minutes ago, garrettm30 said:

This is not entirely accurate. If a particular attribute is set to [No change] in a style and in all styles it depends on, then when you apply that style to a text selection, that particular attribute will not be changed from its initial value. In this way, you can actually define styles to preserve italic and bold settings when applying the style.

It's effective if you are using simple fonts with at least: regular, italic, bold and bold italic.

I'm use to define the font weight in the base styles, since usually the base for headers is set to bold, and the base for body use a different font, not always with "regular" as default, it can be "light", or ""55 regular", etc. That's why I always define precisely the base styles to be sure of what happens later when applying other styles, and those other styles need to be precise too.

But I'm a control freak when doing layouts, and can't stand the "+" on a style, trying to avoid it :)

Some fonts can also be divided in XXX-regular, XXX-black, etc. in the font menu instead of being grouped in the same family, and need more specific entries in the text styles, paragraph or character ones.

Share this post


Link to post
Share on other sites
1 minute ago, Wosven said:

But I'm a control freak when doing layouts, and can't stand the "+" on a style, trying to avoid it :)

I am totally of the same opinion. I do not myself use the procedure I have demonstrated, but at least it is possible for those who do not wish to use character styles as heavily as we do.

Share this post


Link to post
Share on other sites

I completely understand the process as you described it @garrettm30. It makes perfect sense to me. Which is why, when I first spotted it in the style after @Gabe's post, I thought I had my answer.

The problem I now have, however, is that for some reason I cannot set either Base or Body to [No change]. In both cases they switch themselves back to Regular. Which brings me back to the final clause of my original post... "...I am unclear on why this cannot be changed in the style editor."

I would be reasonably confident that if I burned down the style structure and started from scratch I could get something to work, but I'd really like to know if I have found a bug or if there is some factor I am not understanding about why that setting will not change on either style. Remembering [no style] -> Base -> Body.

I've also discovered an interesting fact. The reason "...and Preserve Local Formatting" does not alter the font is because it is impossible to have unstyled text without a locally set font. Try this: create a text frame anywhere and make sure you have [No Style] set in the toolbar for both Paragraph and Character styles. As soon as you type any text, you will have an applied local formatting of the font based on the currently selected font details in the toolbar. As such, the "default style" that @Wosven referred to earlier is not really a default style, as much as a default setting of the toolbar.

Which means... I have to have the style itself actively preserve the local formatting for bold and italic but not the font. Which means... I need to get past my inability to set that in my styles.

I've attached a cut down version of my document where I basically stripped out all my real content but left the style structure as is, along with a test passage of text. The first para is a direct copy of the Markdown, the second para was copied and pasted as rich text. Try getting my Body style applied to the second para while retaining the bold and italics. Also try editing the Body or Base styles to see if you can get the Font trait to stay as [No change].

 

Styles.afpub

Share this post


Link to post
Share on other sites
11 hours ago, zkarj said:

The problem I now have, however, is that for some reason I cannot set either Base or Body to [No change]. In both cases they switch themselves back to Regular. Which brings me back to the final clause of my original post... "...I am unclear on why this cannot be changed in the style editor."

This issue has already been logged with our developers :)

Share this post


Link to post
Share on other sites
19 hours ago, zkarj said:

Try getting my Body style applied to the second para while retaining the bold and italics. Also try editing the Body or Base styles to see if you can get the Font trait to stay as [No change].

Here you go (see attachment). It does work, but you have to work around the bug you have mentioned (which I also reported, twice in fact).

To work around the bug, edit your Base text style by changing the Font family to [No Change], set the Font traits to [No Change], and then set Font family back to the font you want. Do the same for Body text. That is how I could fix your sample file.

Styles-fixed.afpub

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

Please note the Annual Company Closure section in the Terms of Use. These are the Terms of Use you will be asked to agree to if you join the forum. | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.