Find problem

Everything related to our flagship word processor.
Post Reply
User avatar
useeger
Posts: 89
Joined: 2004-06-28 00:03:01
Location: Germany

Find problem

Post by useeger »

After working 15 years with the excellent Nisus Writer Classic I had to switch now to Nisus Writer Pro because I bought a new computer which is not able to run in Classic mode. Therefore a lot of things, which were very easy until now, are now really complicated. I am stuck with the following problem: I used in a large file a font which has the following 5 styles: Regular, Italic, Bold, BoldItalic and SC (= SmallCaps). I want to do now a search für all occurrences of the SC-style. I put "Any" in the Find-window, select it and choose the font in the Format/Font menu. Then I go to the Format/Font Face entry to select the SC-style ... but there is no SC-style, there are only entries for Italic and Bold. So how to find the SC occurrences?

Ulrich
(I apologize if this is a stupid question)
User avatar
martin
Official Nisus Person
Posts: 5227
Joined: 2002-07-11 17:14:10
Location: San Diego, CA
Contact:

Re: Find problem

Post by martin »

Hi Ulrich, it's not a stupid question, but more information is needed before we can answer it.

It sounds like your font doesn't have a true Small Caps font face. If so, then perhaps your document contains non-typographic ("fake") small caps. You might be able to search for that easily, if the small caps attribute is applied uniformly as formatting. But it might also be that your document has manual small caps, eg: uppercase letters with a smaller font size.

The easiest way to answer these questions is for you to post a sample/snippet file pointing out exactly what text you are trying to search for. If you don't want to make a snippet public, you could send me one via the menu Help > Send Feedback. Thanks.
User avatar
phspaelti
Posts: 1313
Joined: 2007-02-07 00:58:12
Location: Japan

Re: Find problem

Post by phspaelti »

Did you check under "Character Case" > "Display as Small Caps"?
Alternatively there is also under Edit > Convert > "To Small Caps".

The two varieties find different things.
philip
User avatar
useeger
Posts: 89
Joined: 2004-06-28 00:03:01
Location: Germany

Re: Find problem

Post by useeger »

Fake Small Caps are a typographical mortal sin. I never use the Small Caps feature provided by word processors. Enclosed is a sample of the fonts used by me named “Haifa”. Unfortunately I can not give it away, because it is based on the copyright-protected font “Goudy” from Adobe. Goudy has not only five but eight different styles.
Attachments
SC.pdf
(98.52 KiB) Downloaded 785 times
User avatar
Elbrecht
Posts: 354
Joined: 2007-03-31 14:59:22
Location: Frankfurt, Germany

Re: Find problem

Post by Elbrecht »

Hi -

I have a "MT Joanna SC" font of old still working for me - did you check with Apple's "Font Book" and/or Nisus Writer Pro menu "Format/Font/ShowFonts" that bypasses the Nisus Font handling - it's a last Option with some fonts not following the Font Family conventions.

And in any Nisus Writer Pro file just place the cursor within a SC section and use the down under [small letter "a" underline] "Select/Remove Character Attributes (such as font and underline)" to "Select All" occurrences of the SC font in the document.

Hope this helps
HE
MacBook Pro i5
SSD 840/850 Pro
High Sierra 10.13.6
Nisus Writer Pro 3.4
User avatar
useeger
Posts: 89
Joined: 2004-06-28 00:03:01
Location: Germany

Re: Find problem

Post by useeger »

Hello HE,

if I put the Cursor in a HaifaSC string and check Format/Font/ShowFonts Haifa SC is shown by the Font Book. If I try to apply that style to my search expression it finds all text written in Haifa Regular or SC style in the selected size. The same result I get with the a-underline tool.

I have some more Adobe fonts with more than the 4 standard styles, for example additional "Semibold", "Light", "Semibold Italic", "Display" and so on. Also Apple's "Hoefler Text" - which comes with the system - has a fith style "Ornaments".

In NW Classic I had two or more entries in the font menu for these fonts, for example Haifa and HaifaSC, Hoefler and Hoefler Ornaments were seperate entries. Now the menu follows font book, which makes 1 font with different styles out of them. And the result seems to be, that it is not possible to search for the additional styles.

But anyway, thanks for your suggestions
Ulrich
User avatar
Elbrecht
Posts: 354
Joined: 2007-03-31 14:59:22
Location: Frankfurt, Germany

Re: Find problem

Post by Elbrecht »

Hi -

not sure what you call "FIND" - I can SELECT/FIND ALL "SC" Font Attributes in a document - to change all to red:

http://elbrecht.com/PDFs/lorem_ipsum_dolor.pdf

HE
MacBook Pro i5
SSD 840/850 Pro
High Sierra 10.13.6
Nisus Writer Pro 3.4
User avatar
martin
Official Nisus Person
Posts: 5227
Joined: 2002-07-11 17:14:10
Location: San Diego, CA
Contact:

Re: Find problem

Post by martin »

I don't have the HaifaSC font to test with, but I see the problem if I try to use another font with face options. For example, trying to search for all text in the "Hoefler Text" font using the "Ornaments" face fails (one can easily select all text in Hoefler, but not just text in the Ornaments face). Even using the little underlined "a" font tag doesn't seem to limit the search to just the Ornaments face. I'll file a bug or two on this.

I would like to say that this isn't a problem for fonts that expose their small caps through Apple's typographic features, instead of using a separate font face. For example, Hoefler has proper typographic small caps that extend over all its faces. To search for that I can insert an "AnyText" PowerFind bubble, apply Hoefler, and then "Display As Small Caps" (which uses real/typographic small caps when a font makes them available). The results of a Find All:
Screen shot 2011-09-13 at 11.10.29 AM.png
Screen shot 2011-09-13 at 11.10.29 AM.png (31.06 KiB) Viewed 21274 times
User avatar
useeger
Posts: 89
Joined: 2004-06-28 00:03:01
Location: Germany

Re: Find problem

Post by useeger »

Ok, I understand now. The problem is, that I was using old fashioned font technology. With Unicode or OpenType fonts NW Pro could do the task as described by the contributers to this topic. So I will make a font substitution in the original files on my old Powerbook G4 replacing the SC style by another "normal" font, which is not used in the documents and afterwards import the documents in NW Pro and then do my find and replace task. The goal is to transform my files completely in the Unicode font "Charis SIL" (which is an excellent an free font for Linguists). I already have a Macro to transform Haifa in Unicode, but the problem was, that it makes no difference between Regular and SC style.

Thanks for making me things clear
Ulrich
User avatar
Elbrecht
Posts: 354
Joined: 2007-03-31 14:59:22
Location: Frankfurt, Germany

Re: Find problem

Post by Elbrecht »

Well -

I don't know about Your Font - but I wonder about your "Regular & SC" thing. A Small Caps Font has the Regular Capitals as well as the "SC" - so what's the use of separating Regular Capitals from proper small caps? Did you use TWO fonts for ONE capitalized word displaying typographic SC - I wonder? For me it's all ONE font only?!?!?!

HE
MacBook Pro i5
SSD 840/850 Pro
High Sierra 10.13.6
Nisus Writer Pro 3.4
User avatar
useeger
Posts: 89
Joined: 2004-06-28 00:03:01
Location: Germany

Re: Find problem

Post by useeger »

Sorry, obviously I caused some misunderstandings about the structure of these mentioned fonts. Perhaps my bad English is the guilty, I have problems to make things clear in a strange language. I can’t provide an Adobe Font for testing, but I have a self made and free font which causes the same problems. Anybody who is interested can download it under the address

http://rabe.macbay.de/nisus/

But I think it is not worth wasting time with it. I am convinced now, that my problem can not be solved in NW Pro, but only with groundwork in NW Classic. My idea to create a Macro that converts all my tons of old Classic/Haifa files in Pro/Charis files was too optimistic.
User avatar
Elbrecht
Posts: 354
Joined: 2007-03-31 14:59:22
Location: Frankfurt, Germany

Re: Find problem

Post by Elbrecht »

Well -

I guessed - a hacked oldy, i.e. you have to Macronize for Unicode; not only the SC, but the other Haifa font faces as well. Here is a list mapping the mis-fits: the great hacked glyphs don't harmonize with the small head line standard glyphs, that's why.

Image

Have a look at the Unicode mapping at http://www.unicode.org for what your Macro should go for. But chances are, you are not the first one, and the Macro exists already!? Search the Forum or Google the Web for a "Haifa Times" + "Unicode" Macro…

HE
MacBook Pro i5
SSD 840/850 Pro
High Sierra 10.13.6
Nisus Writer Pro 3.4
User avatar
useeger
Posts: 89
Joined: 2004-06-28 00:03:01
Location: Germany

Re: Find problem

Post by useeger »

Hello HE,

you nearly reached the beginning of all my efforts. In the wonderful macro of Knut S. Vikør the Small Caps style gets lost (I use it for author’s names in citations). So I looked for a way to convert the Small Caps style first, therefore I had to find a search expression to find all SC occurrences … and we have now reached the beginning of this topic.

Ulrich
Kino
Posts: 400
Joined: 2008-05-17 04:02:32

Re: Find problem

Post by Kino »

Hello Ulrich,
useeger wrote:I had to find a search expression to find all SC occurrences
It’s too late and you seem to have solved the problem but the macro below will allow you to find and select all texts in a specific typeface of a specific font (though it does not work for a typeface faked by NWP or supplied as an OpenType feature). Then, you can mark them all, for example, by applying :Insert:Bookmarks:Add Bookmark.
SelectByPSFontName.png
SelectByPSFontName.png (55.59 KiB) Viewed 20441 times

Code: Select all

Require Pro Version 1.3

$doc = Document.active
if $doc == undefined
	exit 'No open document, exit…'
end

$selsByFont = Hash.new
$properties = Array.new 'characterStyle', 'paragraphStyle'

foreach $text in $doc.allTexts
	if $text.length
		$textRanges = $tableRanges = Array.new
		$tables = $text.tables
		if $tables.count  # then, exclude enclosingTextRange(s)
			foreach $table in $tables
				$range = $table.enclosingTextRange
				$tableRanges.appendValue $range
			end
			$tableRanges.sort
			$i = 0
			foreach $tblRange in $tableRanges
				$range = Range.newWithLocationAndBound $i, $tblRange.location
				$textRanges.appendValue $range
				$i = $tblRange.bound
			end
			$range = Range.newWithLocationAndBound $i, $text.length
			$textRanges.appendValue $range
		else
			$range = Range.new 0, $text.length
			$textRanges.appendValue $range
		end
		foreach $txtRange in $textRanges
			$i = $txtRange.location
			while $i < $txtRange.bound
				$displayAttr = $text.displayAttributesAtIndex $i
				$range = $text.rangeOfDisplayAttributesAtIndex $i
				if $range.location < $i
					$range.location = $i
				end
				if $range.bound > $txtRange.bound
					$range.bound = $txtRange.bound
				end
				$sel = TextSelection.new $text, $range
				$displayFont = $displayAttr.postScriptFontName
				if $displayAttr.isFontSubstituted
					$font = $sel.displayTypingAttributes.postScriptFontName.textByAppending ' [substituted by ',  $displayFont, ']'
				elsif $displayAttr.isFontMissing
					$attr = $text.attributesAtIndex $i
					$originalFont = $attr.postScriptFontName
					if $originalFont == undefined
						foreach $property in $properties
							$style = $attr.getProperty $property
							if Defined $style
								$originalFont = $style.attributes.postScriptFontName
								if Defined $originalFont
									break
								end
							end
						end
					end
					$font = $originalFont.textByAppending ' [missing and displayed by ',  $displayFont, ']'
				else
					$font = $displayFont
				end
				if $selsByFont{$font} == undefined
					$selsByFont{$font} = Array.new
				end
				$selsByFont{$font}.appendValue $sel
				$i = $range.bound
			end
		end
	end
end

$fonts = $selsByFont.keys
if ! $fonts.count
	exit 'No font found, exit…'
end

$fontList = Array.new

foreach $font in $fonts
	foreach $i, $sel in reversed $selsByFont{$font}
		if ! $i
			break
		end
		if $selsByFont{$font}[$i-1].text.isSameObject $sel.text
			if $selsByFont{$font}[$i-1].bound == $sel.location  # then, they are continuous
				$selsByFont{$font}[$i-1].length += $sel.length
				$selsByFont{$font}.removeValueAtIndex $i
			end
		end
	end
	$c = $selsByFont{$font}.count
	$fontList.appendValue "$font\x{200B} ($c)"
end

$fontList.sort 'li'
$message = 'Select text in <PostScript font name> (occurrences)'
$detail = 'Check font name(s) and click OK'
$fontList = Prompt Checkboxes $message, $detail, '', $fontList

if ! $fontList.count
	exit 'Nothing checked, exit…'
end

$sels = Array.new
foreach $font in $fontList
	$font.findAndReplace '\x{200B}.+', '', 'E'
	$sels.appendValuesFromArray $selsByFont{$font}
end

$doc.setSelections $sels
SelectByPSFontName_20120817_nwm.zip
Macro File
(5.23 KiB) Downloaded 801 times
User avatar
useeger
Posts: 89
Joined: 2004-06-28 00:03:01
Location: Germany

Re: Find problem

Post by useeger »

Dear Kino,

your macro is perfect and does exactly what I wanted.

I think it will be useful not only for me but for a lot of other users.

Many, many, many thanks
and best wishes from the hot Germany
(today we will have nearly 40° Celsius = about 104° F)
Ulrich
Post Reply