Jump to content
You must now use your email address to sign in [click for more info] ×

Publisher: one-character prepositions don't work in V2


Recommended Posts

Hi!

In Czech, we have a strange habit not to leave one-character prepositions at the end of the row. In Publisher V1 I used Find/Replace Regular Expression 

(\<[szkvaiouSZKVAIOU])[ ]+

with

 $1<NBSP>

It doesn't work in Publisher V2 anymore. It searches for the characters, but then it mangles them somehow. Can someone help me? Thank you.

Link to comment
Share on other sites

It might help to have a short sample document to play with.

-- Walt
Designer, Photo, and Publisher V1 and V2 at latest retail and beta releases
PC:
    Desktop:  Windows 11 Pro, version 23H2, 64GB memory, AMD Ryzen 9 5900 12-Core @ 3.00 GHz, NVIDIA GeForce RTX 3090 

    Laptop:  Windows 11 Pro, version 23H2, 32GB memory, Intel Core i7-10750H @ 2.60GHz, Intel UHD Graphics Comet Lake GT2 and NVIDIA GeForce RTX 3070 Laptop GPU.
iPad:  iPad Pro M1, 12.9": iPadOS 17.4.1, Apple Pencil 2, Magic Keyboard 
Mac:  2023 M2 MacBook Air 15", 16GB memory, macOS Sonoma 14.4.1

Link to comment
Share on other sites

56 minutes ago, Stepaan said:

It searches for the characters, but then it mangles them somehow.

Works for me. 
Of course, you must replace "<NBSP>" with the actual Non-Breaking Space character selected from the Special Characters submenu.

MacBookAir 15": MacOS Ventura > Affinity v1, v2, v2 beta // MacBookPro 15" mid-2012: MacOS El Capitan > Affinity v1 / MacOS Catalina > Affinity v1, v2, v2 beta // iPad 8th: iPadOS 16 > Affinity v2

Link to comment
Share on other sites

A sample file would still be nice :)

-- Walt
Designer, Photo, and Publisher V1 and V2 at latest retail and beta releases
PC:
    Desktop:  Windows 11 Pro, version 23H2, 64GB memory, AMD Ryzen 9 5900 12-Core @ 3.00 GHz, NVIDIA GeForce RTX 3090 

    Laptop:  Windows 11 Pro, version 23H2, 32GB memory, Intel Core i7-10750H @ 2.60GHz, Intel UHD Graphics Comet Lake GT2 and NVIDIA GeForce RTX 3070 Laptop GPU.
iPad:  iPad Pro M1, 12.9": iPadOS 17.4.1, Apple Pencil 2, Magic Keyboard 
Mac:  2023 M2 MacBook Air 15", 16GB memory, macOS Sonoma 14.4.1

Link to comment
Share on other sites

The big problem is that there is no way (currently) for the text to know and say "Here is the end of a line, as far as the font family and font size and text frame's width and hyphenation rules and justification say this line should end here, before continuing on with the text of the paragraph one line below."

We would need to have the text find all the "one-character prepositions" and replace the "space" with a "Non-Breaking" space. I know nothing about the grammar rules which would allow such a search and replace function so I'll stop now.

Mac Pro (Late 2013) Mac OS 12.7.4 
Affinity Designer 2.4.0 | Affinity Photo 2.4.0 | Affinity Publisher 2.4.0 | Beta versions as they appear.

I have never mastered color management, period, so I cannot help with that.

Link to comment
Share on other sites

33 minutes ago, Old Bruce said:

The big problem is that there is no way (currently) for the text to know and say "Here is the end of a line, as far as the font family and font size and text frame's width and hyphenation rules and justification say this line should end here, before continuing on with the text of the paragraph one line below."

That's why my string simply replaces every such preposition with a NBSP globally. In Czech, there is usually no reason to keep a lone character followed by a whitespace at the end of a line. So if you eventually reflow the frame content, all potential candidates are already fixed.

MacBookAir 15": MacOS Ventura > Affinity v1, v2, v2 beta // MacBookPro 15" mid-2012: MacOS El Capitan > Affinity v1 / MacOS Catalina > Affinity v1, v2, v2 beta // iPad 8th: iPadOS 16 > Affinity v2

Link to comment
Share on other sites

  • 2 months later...

Hello

I found that Publisher V2 have problem with find and replace. When I try to find single letter words with:

(\<[szkvaiouSZKVAIOU])[ ]+

And replace with:

$1<NBSP>

The publisher find it correctly and if I replace one at the time publisher replace it correctly.

But when I click replace all then publisher mix the words. Sometimes replace a to u etc.

Have you same problem?

Link to comment
Share on other sites

2 hours ago, bajqo said:

Publisher V2 have problem with find and replace

2 hours ago, bajqo said:

when I click replace all then publisher mix the words

1 hour ago, bajqo said:

Záznam obrazovky 2023-01-25 o 9.30.03.mov

Good catch!
In v1 it works as expected.
In v2 not.

Looks like a bug to me.

MacBookAir 15": MacOS Ventura > Affinity v1, v2, v2 beta // MacBookPro 15" mid-2012: MacOS El Capitan > Affinity v1 / MacOS Catalina > Affinity v1, v2, v2 beta // iPad 8th: iPadOS 16 > Affinity v2

Link to comment
Share on other sites

2 minutes ago, bajqo said:

I have reportet it as a bug

díky!

MacBookAir 15": MacOS Ventura > Affinity v1, v2, v2 beta // MacBookPro 15" mid-2012: MacOS El Capitan > Affinity v1 / MacOS Catalina > Affinity v1, v2, v2 beta // iPad 8th: iPadOS 16 > Affinity v2

Link to comment
Share on other sites

I don’t know anything about Czech, but reading the explanations, I think it’s more a problem with the Czech hyphenation dictionary than with Regex. I’d have to see what the creators of this dictionary on FireFox think about it.

6 cœurs, 12 processus - Windows 11 pro - 4K - DirectX 12 - Suite universelle Affinity (Affinity  Publisher, Affinity Designer, Affinity Photo).

Mais je vous le demande, peut-on imaginer une police sans sérifs ?

Link to comment
Share on other sites

1 hour ago, Pyanepsion said:

I think it’s more a problem with the Czech hyphenation dictionary than with Regex.

The issue discussed herein is that the same regex pattern is not giving the same result in v2 on Replace All. See @bajqo's screencast.

MacBookAir 15": MacOS Ventura > Affinity v1, v2, v2 beta // MacBookPro 15" mid-2012: MacOS El Capitan > Affinity v1 / MacOS Catalina > Affinity v1, v2, v2 beta // iPad 8th: iPadOS 16 > Affinity v2

Link to comment
Share on other sites

\< is a GNU extension which is not supported by most regular expression engines; I wonder if they changed engines or grammars between the two versions?

I don't have any Czech text to test on, but try using either \b or [[:<:]] instead of \< to see if that makes a difference?

More details on these differences are documented here: https://www.regular-expressions.info/wordboundaries.html

Link to comment
Share on other sites

13 minutes ago, fde101 said:

\< is a GNU extension which is not supported by most regular expression engines; I wonder if they changed engines or grammars between the two versions?

I don't have any Czech text to test on, but try using either \b or [[:<:]] instead of \< to see if that makes a difference?

More details on these differences are documented here: https://www.regular-expressions.info/wordboundaries.html

I think that is not the problem. Publisher find what we want to. But difference is when you change it one by time or replace all. Please see video. 

But I try to change but still same result. Replace one by one works well but Replace All make a mess.

Link to comment
Share on other sites

The initial question is about the malfunction of the Czech language software, which therefore requires not to leave single-character words at the end of a line.

There is definitely a bug in the Regex handling of Replace All. Even if this bug is solved, it will not solve the original issue. Systematically pasting the one letter word to the word that follows is completely irrelevant, as it will create an inevitable malfunction in the justification.

Perhaps the solution is to add the Czech language to the dictionary of languages and hyphenations?

Here:

https://affinity.help/publisher2/English.lproj/index.html

Search:

Hyphen

Select

Managing hyphenation dictionaries

Then:

Hyphenation

What does it look like?

6 cœurs, 12 processus - Windows 11 pro - 4K - DirectX 12 - Suite universelle Affinity (Affinity  Publisher, Affinity Designer, Affinity Photo).

Mais je vous le demande, peut-on imaginer une police sans sérifs ?

Link to comment
Share on other sites

3 hours ago, Pyanepsion said:

The initial question is about the malfunction of the Czech language software

@Stepaan's post was exactly about the specific regex pattern not functioning correctly in v2.
While I have initally stated that it "works for me", at that time I have only checked the "find" part of the search, not the "replace all" part. The latter appears to be broken in v2.

3 hours ago, Pyanepsion said:

Perhaps the solution is to add the Czech language to the dictionary of languages and hyphenations?

It has nothing to do with the Czech dictionary as I'm using it already.

3 hours ago, Pyanepsion said:

It looks like you have pasted the wrong links… ;) 

MacBookAir 15": MacOS Ventura > Affinity v1, v2, v2 beta // MacBookPro 15" mid-2012: MacOS El Capitan > Affinity v1 / MacOS Catalina > Affinity v1, v2, v2 beta // iPad 8th: iPadOS 16 > Affinity v2

Link to comment
Share on other sites

17 hours ago, loukash said:

@Stepaan's post was exactly about the specific regex pattern not functioning correctly in v2.

Hum. 🙂

On 11/15/2022 at 8:11 PM, Stepaan said:

In Czech, we have a strange habit not to leave one-character prepositions at the end of the row.

The question about the Regex is just a consequence of wanting to solve a peculiarity of Czech typography.

For typing in the Affinity suite, I would rather see an auto-correction option in the preferences that would allow to replace one-letter words then space by the letter itself followed by a non-breaking space. This would solve most of the problem and could even be generalised to other situations. It should be possible to specify any sequence of characters.

A bit like Word which allows you to automatically replace " with <nbsp>» where <nbsp> is a non-breaking space, or (c) by ©. To this can be added the knowledge of Unicode, that it understands for example that U+00C9 corresponds to É.

When it comes to rectifying a text already present in Affinity Publisher, I suggest the following sequence to be run as many times as necessary. It works with the Replace All function, whether there is one or more successive one-letter words:

Search:

[ |<nbsp>]([a|i|k|o|s|u|v|z|A|I|K|O|S|U|V|Z])[ ]+

Replace with:

[ ]$1<nbsp>

🔴The Online help does not provide direct links! I'm modifying it with a workaround.

6 cœurs, 12 processus - Windows 11 pro - 4K - DirectX 12 - Suite universelle Affinity (Affinity  Publisher, Affinity Designer, Affinity Photo).

Mais je vous le demande, peut-on imaginer une police sans sérifs ?

Link to comment
Share on other sites

  • 3 weeks later...
1 hour ago, Stepaan said:

Hi! If it's still relevant, here are Regex expressions that work:

Find: \h([szkvaiouSZKVAIOU])\b\h
Replace:  "mezera"$1<NBSP>

 

Ahoj

Nájde to každé druhé... neviem či je chyba v tom, že to testujem na sérii znakov, ktoré má hľadať ale teoreticky by malo nájsť všetky.

Snímka obrazovky 2023-02-14 o 14.19.56.png

Link to comment
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.

Loading...
×
×
  • Create New...

Important Information

Terms of Use | 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.