在Scriptui (Extendscript)中,我如何在按钮标题中使用下标或上标? 我以buttonTitle为例,在对话框中显示任何字符字符串。
在这个例子中。
var win = new Window("dialog");
var buttonTitle = "Button2";
win.aButton = win.add("button", undefined, buttonTitle);
win.show();
我如何将buttonTitle编码为 "ButtonX",其中X是上标或下标2? 或者是字母Y? 数字在某些字体中是可用的,但字母可能就不行了。 我希望得到一个通用的解决方案。
我很感激你的时间,谢谢你,RONC。
这是一个屏幕剧情的scriptui问题。
RONC
今天才看到这个,很抱歉花了这么长时间.你可以尝试使用unicode代码来处理。请看本页的表格。
https:/en.wikipedia.orgwikiUnicode_subscripts_and_superscripts(简体中文)
但这些字符确实很小! 有字母字符的代码可供选择,但我没有测试任何代码。这里有一些代码可以测试,并附注。
function buildUI(this_obj_) {
var win = (this_obj_ instanceof Panel)
? this_obj_
: new Window('palette', 'Script Window',[147,196,528,330]);
// \u00B2 for super 2, \u00B3 for super 3; the rest are \u2070 for super zero, \u2071 for super one, \u2074 for super four, \u2075 for super five, etc...
win.xui_ui_button5 = win.add('button', [49,24,177,54], 'Super\u00B2');
win.xui_ui_button5.onClick = function () {this.parent.close(1);}
// \u2081 for sub 1, \u2082 for sub 2, \u2083 for sub 3, etc...
win.xui_ui_button6 = win.add('button', [49,65,177,95], 'Sub\u2082');
win.xui_ui_button6.onClick = function () {this.parent.close(1);}
return win
}
var w = buildUI(this);
if (w.toString() == "[object Panel]") {
w;
} else {
w.show();
}
[编辑: 这里是这段代码在After Effects中创建的调色板窗口的截图]
[编辑2:这里是在Photoshop中使用模态对话框工作的代码(我在这台机器上的PS旧版本上测试,但它应该可以工作,但在最新版本上看起来不一样)。
var win = new Window('dialog', 'Script Window',[670,456,1160,598]);
var w = buildUI();
if (w != null) {
w.show();
}
function buildUI() {
if (win != null) {
win.xui_ui_button5 = win.add('button', [64,11,231,51], 'Super\u00B2');
win.xui_ui_button5.onClick = function () {this.parent.close(1);}
win.xui_ui_button6 = win.add('button', [264,63,431,103], 'Sub\u2082');
win.xui_ui_button6.onClick = function () {this.parent.close(1);}
}
return win
}