[GastForen Programme Print/Bildbearbeitung Adobe InDesign

  • Suche
  • Hilfe
  • Lesezeichen
  • Benutzerliste

Abstände im Blocksatz kontrollieren

Gerald Singelmann
  
Beiträge gesamt: 6269

21. Feb 2006, 14:35
Bewertung:

gelesen: 18943

Beitrag als Lesezeichen
Hi all,

wir hatten kürzlich das Thema, welche Abstände eigentlich genau in einer Blocksatzzeile stehen. Die 3 Gelb-Abstufungen sind ja nicht sooo aussagekräftig.

Und da der Score "Nützliche Skripte von Martin : Nützliche Skripte von anderen" etwa bei 2491:5 steht, habe ich mal folgenden Ansatz (derzeit nur AppleScript) umgesetzt.
Anleitung: wie üblich in den Skript-Ordner kopieren, einen Textrahmen markieren, vorzugsweise einen, in dem Blocksatz enthalten ist, und über die Skript-Palette starten.

Das Skript geht davon aus, dass alle WA in einer Zeile gleich groß sind und dass alle Zeichen gleich skaliert wurden (wenn überhaupt). Das ist nicht ganz korrekt (es gibt anscheinend Ausnahmen), dürfte in den meisten Fällen aber ausreichen.

Code
tell application "Adobe InDesign CS2" 
set myDoc to active document
set mySel to selection
try
set myLayer to layer "checkText" of myDoc
on error
tell myDoc to set myLayer to make layer with properties {name:"checkText"}
end try

repeat with myFrame in selection
if class of myFrame is text frame then
set myDFrame to duplicate myFrame
set item layer of myDFrame to myLayer

set nLines to count lines of myDFrame
set myStory to parent story of myDFrame
set softReturnHere to {}
repeat with n from nLines to 1 by -1
set softReturnHere to softReturnHere & (index of last character of line n of myDFrame)
end repeat
repeat with n from 1 to nLines
set myIndex to (item n of softReturnHere) + 1
set nChars to count characters of myStory
set lastChar to character (myIndex - 1) of myStory
if (myIndex < nChars) and (lastChar is not "
") and (lastChar is not forced line break) then
set contents of insertion point (myIndex) of myDFrame to forced line break
end if
end repeat

set prevBounds to geometric bounds of myDFrame
set geometric bounds of myDFrame to {(item 1 of prevBounds), item 2 of prevBounds, (item 3 of prevBounds), (item 4 of prevBounds) + 50}

set justification of text of myDFrame to left align
set desired word spacing of text of myDFrame to 100
set desired letter spacing of text of myDFrame to 0
set desired glyph scaling of text of myDFrame to 100
try
set fill color of text of myDFrame to swatch "rot" of myDoc
on error
tell myDoc to set nuColor to make color
tell nuColor
set space to RGB
set color value to {192, 0, 0}
set name to "rot"
end tell
set fill color of text of myDFrame to swatch "rot" of myDoc
end try

set wordscalings to {}
repeat with q from 1 to nLines
set nWords to count words in line q of myFrame
set nChars to count characters in line q of myFrame

set myIndex to (index of last character) of word 1 of line q of myFrame
set myDIndex to (index of last character) of word 1 of line q of myDFrame
set myFirst to index of first character of line q of myDFrame
set myLast to index of last character of line q of myDFrame

set aSpace to (horizontal offset of character (myIndex + 2) of myFrame) - (horizontal offset of character (myIndex + 1) of myFrame)
set aSpaceD to (horizontal offset of character (myDIndex + 2) of myDFrame) - (horizontal offset of character (myDIndex + 1) of myDFrame)

set aChar to (horizontal offset of character (myIndex + 1) of myFrame) - (horizontal offset of character (myIndex) of myFrame)
set aCharD to (horizontal offset of character (myDIndex + 1) of myDFrame) - (horizontal offset of character (myDIndex) of myDFrame)
set wordscalings to wordscalings & ("w: " & (((aSpace * 1000) div aSpaceD) / 10 & "- c: " & ((aChar * 1000) div aCharD) / 10) as string)
set point size of (text from character myFirst to character (myLast - 1)) of myDFrame to 6
set contents of (text from character myFirst to character (myLast - 1)) of myDFrame to (item q of wordscalings)
end repeat

set prevBounds to geometric bounds of myFrame
set geometric bounds of myDFrame to {(item 1 of prevBounds), (item 2 of prevBounds) - 30, (item 3 of prevBounds), (item 2 of prevBounds)}

-- activate
end if
end repeat
end tell


(Dieser Beitrag wurde von Christoph Steffens am 23. Feb 2006, 08:31 geändert)
Änderungsverlauf:
Beitrag geändert von Christoph Steffens (Moderator) am 23. Feb 2006, 08:31: Der Code wurde nicht korrekt wiedergegeben, musste manuell geändert werden.