Stepaan Posted November 15, 2022 Posted November 15, 2022 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. Quote
walt.farrell Posted November 15, 2022 Posted November 15, 2022 It might help to have a short sample document to play with. Quote -- Walt Designer, Photo, and Publisher V1 and V2 at latest retail and beta releases PC: Desktop: Windows 11 Pro 23H2, 64GB memory, AMD Ryzen 9 5900 12-Core @ 3.00 GHz, NVIDIA GeForce RTX 3090 Laptop: Windows 11 Pro 23H2, 32GB memory, Intel Core i7-10750H @ 2.60GHz, Intel UHD Graphics Comet Lake GT2 and NVIDIA GeForce RTX 3070 Laptop GPU. Laptop 2: Windows 11 Pro 24H2, 16GB memory, Snapdragon(R) X Elite - X1E80100 - Qualcomm(R) Oryon(TM) 12 Core CPU 4.01 GHz, Qualcomm(R) Adreno(TM) X1-85 GPU iPad: iPad Pro M1, 12.9": iPadOS 18.3, Apple Pencil 2, Magic Keyboard Mac: 2023 M2 MacBook Air 15", 16GB memory, macOS Sequoia 15.0.1
loukash Posted November 15, 2022 Posted November 15, 2022 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. Quote 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
loukash Posted November 15, 2022 Posted November 15, 2022 Other than that, my regex string from the old thread works just as well: jussi and Stepaan 2 Quote 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
Stepaan Posted November 15, 2022 Author Posted November 15, 2022 Strange. I realized I posted in that thread too. The RegEx of mine doesn't work in V2, yours is OK. Quote
walt.farrell Posted November 15, 2022 Posted November 15, 2022 A sample file would still be nice Quote -- Walt Designer, Photo, and Publisher V1 and V2 at latest retail and beta releases PC: Desktop: Windows 11 Pro 23H2, 64GB memory, AMD Ryzen 9 5900 12-Core @ 3.00 GHz, NVIDIA GeForce RTX 3090 Laptop: Windows 11 Pro 23H2, 32GB memory, Intel Core i7-10750H @ 2.60GHz, Intel UHD Graphics Comet Lake GT2 and NVIDIA GeForce RTX 3070 Laptop GPU. Laptop 2: Windows 11 Pro 24H2, 16GB memory, Snapdragon(R) X Elite - X1E80100 - Qualcomm(R) Oryon(TM) 12 Core CPU 4.01 GHz, Qualcomm(R) Adreno(TM) X1-85 GPU iPad: iPad Pro M1, 12.9": iPadOS 18.3, Apple Pencil 2, Magic Keyboard Mac: 2023 M2 MacBook Air 15", 16GB memory, macOS Sequoia 15.0.1
Stepaan Posted November 15, 2022 Author Posted November 15, 2022 22 minutes ago, walt.farrell said: A sample file would still be nice 🙂 Thank you. The loukash's way works, mine doesn't. In V2... Look for all single characters at the end of a row. One_char_prep.afpub walt.farrell 1 Quote
Old Bruce Posted November 15, 2022 Posted November 15, 2022 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. Quote Mac Pro (Late 2013) Mac OS 12.7.6 Affinity Designer 2.5.7 | Affinity Photo 2.5.7 | Affinity Publisher 2.5.7 | Beta versions as they appear. I have never mastered color management, period, so I cannot help with that.
loukash Posted November 15, 2022 Posted November 15, 2022 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. Quote 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
Stepaan Posted November 16, 2022 Author Posted November 16, 2022 Thank you all. I understand the practice with NBSP. I just wondered, why this one particular syntaxe stopped working while the other works... Until there is a solution for one-character prepositions, It's OK Quote
bajqo Posted January 23, 2023 Posted January 23, 2023 Hello, I have same problem as @Stepaan. Worst part is that i made 2 boklets and customer did not check it so there are lot of changed words.... Is it working solution now? And is there similar solution for two-character prepositions? Thank you / Ďakujem chlapci. Quote
bajqo Posted January 25, 2023 Posted January 25, 2023 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? Quote
bajqo Posted January 25, 2023 Posted January 25, 2023 Sending video. It is dissapointing. I have printet 400 brochures after correcting and now I must reprint. The solution is correct but is not replacing it correctly. Keep in mind that. Záznam obrazovky 2023-01-25 o 9.30.03.mov Quote
loukash Posted January 25, 2023 Posted January 25, 2023 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. Quote 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
bajqo Posted January 25, 2023 Posted January 25, 2023 2 hours ago, loukash said: Good catch! In v1 it works as expected. In v2 not. Looks like a bug to me. I have reportet it as a bug. We will see... loukash 1 Quote
loukash Posted January 25, 2023 Posted January 25, 2023 2 minutes ago, bajqo said: I have reportet it as a bug díky! Quote 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
Pyanepsion Posted January 26, 2023 Posted January 26, 2023 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. Quote 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 ?
loukash Posted January 26, 2023 Posted January 26, 2023 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. Quote 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
fde101 Posted January 26, 2023 Posted January 26, 2023 \< 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 Quote
bajqo Posted January 26, 2023 Posted January 26, 2023 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. Quote
Pyanepsion Posted January 26, 2023 Posted January 26, 2023 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? Quote 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 ?
loukash Posted January 26, 2023 Posted January 26, 2023 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: Here: https://affinity.help/publisher2/English.lproj/index.html Then: https://affinity.help/publisher2/English.lproj/index.html What does it look like? It looks like you have pasted the wrong links… Quote 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
Pyanepsion Posted January 26, 2023 Posted January 26, 2023 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. Quote 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 ?
Stepaan Posted February 14, 2023 Author Posted February 14, 2023 Hi! If it's still relevant, here are Regex expressions that work: Find: \h([szkvaiouSZKVAIOU])\b\h Replace: "mezera"$1<NBSP> Quote
bajqo Posted February 14, 2023 Posted February 14, 2023 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. Quote
Recommended Posts
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.