首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何将AAT上下文连接添加到TTF字体中?

如何将AAT上下文连接添加到TTF字体中?
EN

Stack Overflow用户
提问于 2014-08-14 05:43:27
回答 1查看 655关注 0票数 2

我正在为Sgaw Karen开发字体,这是一种需要根据上下文来塑造字符(和连接线)的语言。我的字体运行良好,然而,我希望添加一个AAT表,以更好地支持Mac。

但是,我很难理解AAT字体特性的语法。特别是上下文类型。我读过苹果参考文档和教程文档,并看过列出的这里示例。

基本上,我有两个字符,比方说X和Y,如果后面跟着一组字符,则需要将X和Y替换为一个连接,比如N和M,对于FontLab Studio中的FontLab特性,我只需说:

代码语言:javascript
复制
sub X' Y' [N M] by X_Y.alt;

而且效果很好。我在AAT怎么做同样的事?

这是我的全部OT代码:

代码语言:javascript
复制
feature clig {

script mymr;
@needSpaceOnTop = [uni102B uni1032 uni102D uni102E];

sub uni1000' uni103C' @needSpaceOnTop by uni1000_uni103C.alt;
sub uni1003' uni103C' @needSpaceOnTop by uni1003_uni103C.alt;
sub uni1006' uni103C' @needSpaceOnTop by uni1006_uni103C.alt;
sub uni1010' uni103C' @needSpaceOnTop by uni1010_uni103C.alt;
sub uni1011' uni103C' @needSpaceOnTop by uni1011_uni103C.alt;
sub uni1018' uni103C' @needSpaceOnTop by uni1018_uni103C.alt;
sub uni101C' uni103C' @needSpaceOnTop by uni101C_uni103C.alt;
sub uni101E' uni103C' @needSpaceOnTop by uni101E_uni103C.alt;
sub uni101F' uni103C' @needSpaceOnTop by uni101F_uni103C.alt;
sub uni1001' uni103C' @needSpaceOnTop by uni1001_uni103C.alt;
sub uni1002' uni103C' @needSpaceOnTop by uni1002_uni103C.alt;
sub uni100E' uni103C' @needSpaceOnTop by uni100E_uni103C.alt;
sub uni1004' uni103C' @needSpaceOnTop by uni1004_uni103C.alt;
sub uni1005' uni103C' @needSpaceOnTop by uni1005_uni103C.alt;
sub uni1007' uni103C' @needSpaceOnTop by uni1007_uni103C.alt;
sub uni1012' uni103C' @needSpaceOnTop by uni1012_uni103C.alt;
sub uni1015' uni103C' @needSpaceOnTop by uni1015_uni103C.alt;
sub uni1016' uni103C' @needSpaceOnTop by uni1016_uni103C.alt;
sub uni1019' uni103C' @needSpaceOnTop by uni1019_uni103C.alt;
sub uni101D' uni103C' @needSpaceOnTop by uni101D_uni103C.alt;
sub uni1065' uni103C' @needSpaceOnTop by uni1065_uni103C.alt;

} clig;

下面是OS字体工具文档中的上下文示例:

代码语言:javascript
复制
------------------------------------------------------------------
//  Turn medial s into long s
------------------------------------------------------------------
Type        Contextual
Name        Smart Swashes
Namecode    8
Setting     Medial Long-s
Settingcode 8
Default     no
Orientation H
Forward     yes
Exclusive   no

Ess     s
Lower   a b c d e f g h i j k l m n o p q r t u v w x y z

            EOT OOB DEL EOL Ess Lower
StartText   1   1   1   1   2   1
StartLine   1   1   1   1   2   1
SawS        1   1   1   1   3   4
SawSS       1   1   1   1   3   4

    GoTo        Mark?   Advance?    SubstMark   SubstCurrent
1   StartText   no      yes         none        none
2   SawS        yes     yes         none        none
3   SawSS       yes     yes         ToLongS     none
4   StartText   no      yes         ToLongS     none

ToLongS
    s   slong
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-08-21 05:57:56

好吧,我自己想出来了。AAT不直接支持上下文连接。但是,您可以通过使用两次传球来使其工作,如下所示:

如果后面跟着N或M,则将X_Y更改为X_Y:

代码语言:javascript
复制
//====================================================
//  Step 1: change Y to an arbitrary high glyph number
//  if it is preceded by X and followed by N or M  
//====================================================

Type Contextual
Name NULL
Namecode 7
Setting NULL
Settingcode 0
Default yes
Orientation HV
Forward yes
Exclusive no

// Define some classes
X X
Y Y
NM N M

// Define what action to take for state/action
            EOT     OOB     DEL     EOL   X     Y    NM
StartText   1       1       1       1     2     1    1
StartLine   1       1       1       1     2     1    1
SawX        1       1       1       1     1     3    1
SawY        1       1       1       1     1     1    4

// The state machine starts off in the StartText or StartLine state.
// If it sees an X in one of those states, it changes to the SawX
// state. If it's in the SawX state and sees a Y, then it changes to
// the SawY state and marks that character (the Y) for possible
// future processing. Then if it sees an N or M in the SawY state,
// it runs the DoSub on the marked Y, and returns to the StartText state.

// Actions - the Goto column tells what state to take for
// the next round.

  GoTo      Mark? Advance?    SubstMark   SubstCurrent
1 StartText no    yes         none        none
2 SawX      no    yes         none        none
3 SawY      yes   yes         none        none
4 StartText no    yes         DoSub       none

// Subs Y by 5999
DoSub
      Y 5999

//====================================================
// Step 2: Change the X 5999 to X_Y
//====================================================

Type          LigatureList
Name          NULL
Namecode      7
Setting       NULL
Settingcode   0
Default       yes
Orientation   HV
Forward       yes
Exclusive     no

// Replace X 5999 by X_Y
List
    X_Y X 5999

当然,为了使其正常工作,5999不能是以前存在的字形id。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/25300798

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档