-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add toggleAlignToGlyphBounds.js, toggleShowHandles.js
- Loading branch information
1 parent
ca51a2c
commit 1f62610
Showing
6 changed files
with
296 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
/* =============================================================================================================================================== | ||
toggleAlignToGlyphBounds | ||
Description | ||
This script toggles the Align panel menu > Align to Glyph Bounds > Point Text and Area Text. | ||
Usage | ||
Just run this script from File > Scripts > Other Script... | ||
Notes | ||
In rare cases, the script may not work if you continue to use it. | ||
In this case, restart Illustrator and try again. | ||
Requirements | ||
Illustrator 2020 or higher | ||
Version | ||
1.0.0 | ||
Homepage | ||
github.com/sky-chaser-high/adobe-illustrator-scripts | ||
License | ||
Released under the MIT license. | ||
https://opensource.org/licenses/mit-license.php | ||
=============================================================================================================================================== */ | ||
|
||
(function() { | ||
if (app.documents.length && isValidVersion()) main(); | ||
})(); | ||
|
||
|
||
function main() { | ||
var pref = app.preferences; | ||
var glyph = pref.getBooleanPreference('EnableActualTextSpaceAlign'); | ||
pref.setBooleanPreference('EnableActualTextSpaceAlign', !glyph); | ||
pref.setBooleanPreference('EnableActualAreaTextSpaceAlign', !glyph); | ||
showDialog(glyph); | ||
} | ||
|
||
|
||
function isValidVersion() { | ||
var cc2020 = 24.3; | ||
var aiVersion = parseFloat(app.version); | ||
if (aiVersion < cc2020) return false; | ||
return true; | ||
} | ||
|
||
|
||
function showDialog(glyph) { | ||
$.localize = true; | ||
var ui = localizeUI(); | ||
|
||
var dialog = new Window('dialog'); | ||
dialog.text = ui.title; | ||
dialog.preferredSize.width = 260; | ||
dialog.orientation = 'column'; | ||
dialog.alignChildren = ['fill', 'top']; | ||
dialog.spacing = 10; | ||
dialog.margins = 16; | ||
|
||
var group1 = dialog.add('group', undefined, { name: 'group1' }); | ||
group1.orientation = 'row'; | ||
group1.alignChildren = ['center', 'center']; | ||
group1.spacing = 10; | ||
group1.margins = 20; | ||
|
||
var statictext1 = group1.add('statictext', undefined, undefined, { name: 'statictext1' }); | ||
statictext1.text = glyph ? ui.off : ui.on; | ||
|
||
var group2 = dialog.add('group', undefined, { name: 'group2' }); | ||
group2.orientation = 'row'; | ||
group2.alignChildren = ['center', 'center']; | ||
group2.spacing = 10; | ||
group2.margins = 0; | ||
|
||
var button1 = group2.add('button', undefined, undefined, { name: 'button1' }); | ||
button1.text = ui.ok; | ||
button1.preferredSize.width = 90; | ||
|
||
dialog.show(); | ||
} | ||
|
||
|
||
function localizeUI() { | ||
var aiVersion = parseFloat(app.version); | ||
return { | ||
title: { | ||
en: 'Align to Glyph Bounds', | ||
ja: (aiVersion < 25) ? 'グリフバウンドに整列' : '字形の境界に整列' | ||
}, | ||
on: { | ||
en: 'ON', | ||
ja: 'ON' | ||
}, | ||
off: { | ||
en: 'OFF', | ||
ja: 'OFF' | ||
}, | ||
ok: { | ||
en: 'OK', | ||
ja: 'OK' | ||
} | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
/* =============================================================================================================================================== | ||
toggleShowHandles | ||
Description | ||
This script toggles the Preferences > Selection & Anchor Display > Anchor Points, Handle, and Bounding Box Display > Show handles when multiple anchors are selected. | ||
Usage | ||
Just run this script from File > Scripts > Other Script... | ||
Notes | ||
In rare cases, the script may not work if you continue to use it. | ||
In this case, restart Illustrator and try again. | ||
Requirements | ||
Illustrator CC or higher | ||
Version | ||
1.0.0 | ||
Homepage | ||
github.com/sky-chaser-high/adobe-illustrator-scripts | ||
License | ||
Released under the MIT license. | ||
https://opensource.org/licenses/mit-license.php | ||
=============================================================================================================================================== */ | ||
|
||
(function() { | ||
if (app.documents.length && isValidVersion()) main(); | ||
})(); | ||
|
||
|
||
function main() { | ||
var pref = app.preferences; | ||
var handle = pref.getBooleanPreference('showDirectionHandles'); | ||
pref.setBooleanPreference('showDirectionHandles', !handle); | ||
|
||
var items = app.activeDocument.selection; | ||
if (!items.length) showDialog(handle); | ||
} | ||
|
||
|
||
function isValidVersion() { | ||
var cc = 17; | ||
var aiVersion = parseFloat(app.version); | ||
if (aiVersion < cc) return false; | ||
return true; | ||
} | ||
|
||
|
||
function showDialog(handle) { | ||
$.localize = true; | ||
var ui = localizeUI(); | ||
|
||
var dialog = new Window('dialog'); | ||
dialog.text = ui.title; | ||
dialog.preferredSize.width = 350; | ||
dialog.orientation = 'column'; | ||
dialog.alignChildren = ['fill', 'top']; | ||
dialog.spacing = 10; | ||
dialog.margins = 16; | ||
|
||
var group1 = dialog.add('group', undefined, { name: 'group1' }); | ||
group1.orientation = 'row'; | ||
group1.alignChildren = ['center', 'center']; | ||
group1.spacing = 10; | ||
group1.margins = 20; | ||
|
||
var statictext1 = group1.add('statictext', undefined, undefined, { name: 'statictext1' }); | ||
statictext1.text = handle ? ui.hide : ui.show; | ||
|
||
var group2 = dialog.add('group', undefined, { name: 'group2' }); | ||
group2.orientation = 'row'; | ||
group2.alignChildren = ['center', 'center']; | ||
group2.spacing = 10; | ||
group2.margins = 0; | ||
|
||
var button1 = group2.add('button', undefined, undefined, { name: 'button1' }); | ||
button1.text = ui.ok; | ||
button1.preferredSize.width = 90; | ||
|
||
dialog.show(); | ||
} | ||
|
||
|
||
function localizeUI() { | ||
return { | ||
title: { | ||
en: 'Show handles for multiple selected anchor points', | ||
ja: '選択した複数のアンカーポイントのハンドルを表示' | ||
}, | ||
show: { | ||
en: 'Show', | ||
ja: '表示' | ||
}, | ||
hide: { | ||
en: 'Hide', | ||
ja: '非表示' | ||
}, | ||
ok: { | ||
en: 'OK', | ||
ja: 'OK' | ||
} | ||
}; | ||
} |