小众编程问题:我正在通过字节制作来开发 OpenType 字体(而不是使用 Fontlab 或 FontForge 等设计工具),现在有一个自定义 OpenType-CFF 字体,它实现了 Basic Latin unicode block 的一个子集(特别是它实现了 .notdef 和波浪号)。
CFF block 通过tx -3 验证(http://www.adobe.com/devnet/opentype/afdko.html),整个字体通过TTX(https://github.com/behdad/fonttools)进行往返反编译/重新编译。 ),并且 Microsoft 的“字体验证器”(http://www.microsoft.com/typography/FontValidator.mspx) 不会报告字体中的任何错误。将其作为自定义 webfont 加载(在支持 otf 的浏览器中作为普通 otf,在不支持 otf 的浏览器中包装为 WOFF)正确设置已实现字形的样式。
然而,即使表面上看起来正确,Windows 字体预览器仍会报告它不是有效的字体文件,并且 Window 不会让我安装它。我四处寻找有关 Windows 需要安装字体的信息,但互联网上似乎充斥着如何作为用户使用字体,而不是作为开发人员需要满足哪些要求。
我不太确定包含这个问题的代码的最佳方法是什么,因为它不是很传统的编程;生成器代码是用 JavaScript 编写的,但该代码工作得非常好,并为所有意图和目的(保存一个)生成适当的字体。
如果您知道如何使用十六进制编辑器,那么以下是字体的十六进制字符串:
4F 54 54 4F 00 09 00 80 00 03 00 10 43 46 46 20 03 00 B4 92 00 00 02 A4 00 00 00 B3 4F 53 2F 32
30 F6 24 D4 00 00 01 00 00 00 00 60 63 6D 61 70 00 0D 00 B7 00 00 02 50 00 00 00 32 68 65 61 64
61 E4 43 91 00 00 00 9C 00 00 00 36 68 68 65 61 06 96 01 52 00 00 00 D4 00 00 00 24 68 6D 74 78
02 A8 00 00 00 00 03 58 00 00 00 08 6D 61 78 70 00 02 50 00 00 00 00 F8 00 00 00 06 6E 61 6D 65
C6 CC FF EC 00 00 01 60 00 00 00 F0 70 6F 73 74 00 03 00 01 00 00 02 84 00 00 00 20 00 01 00 00
00 01 00 00 1A EA FF 64 5F 0F 3C F5 00 00 04 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 14 FF EC 02 BC 02 A8 00 00 00 08 00 02 00 00 00 00 00 00 00 01 00 00 03 EC FE A8 00 00 02 A8
00 00 00 00 02 A8 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 02 00 00 50 00 00 02 00 00
00 03 00 00 01 90 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 20 3D 29 20 00 40
00 7E 00 7E 02 A8 FF EC 01 44 03 EC 01 58 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 7E 00 00
00 00 00 08 00 66 00 01 00 20 00 00 00 01 00 0B 00 00 00 01 00 20 00 00 00 02 00 07 00 21 00 01
00 20 00 00 00 04 00 11 00 36 00 01 00 20 00 00 00 05 00 0B 00 69 00 03 00 01 04 09 00 01 00 16
00 0B 00 03 00 01 04 09 00 02 00 0E 00 28 00 03 00 01 04 09 00 04 00 22 00 47 00 03 00 01 04 09
00 05 00 16 00 74 43 75 73 74 6F 6D 20 46 6F 6E 74 00 43 00 75 00 73 00 74 00 6F 00 6D 00 20 00
46 00 6F 00 6E 00 74 52 65 67 75 6C 61 72 00 52 00 65 00 67 00 75 00 6C 00 61 00 72 43 75 73 74
6F 6D 20 47 6C 79 70 68 20 46 6F 6E 74 00 43 00 75 00 73 00 74 00 6F 00 6D 00 20 00 47 00 6C 00
79 00 70 00 68 00 20 00 46 00 6F 00 6E 00 74 56 65 72 73 69 6F 6E 20 31 2E 30 00 56 00 65 00 72
00 73 00 69 00 6F 00 6E 00 20 00 31 00 2E 00 30 00 00 00 01 00 03 00 01 00 00 00 0C 00 04 00 26
00 00 00 04 00 04 00 01 00 00 00 7E FF FF 00 00 00 7E FF FF FF 83 00 01 00 00 00 00 00 00 00 00
00 01 00 00 00 03 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 01 00 04 01 00 01 01 01 0B 63 75 73 74 6F 6D 66 6F 6E 74 00 01 01 01 23 F8 1B 00 F8
1C 02 F8 1D 03 F8 19 04 8C 0D 9F 77 F9 50 F9 3C 05 F7 05 0F F7 08 10 F7 0B 11 9B F7 37 12 00 04
01 01 0C 1D 28 2E 56 65 72 73 69 6F 6E 20 31 2E 30 43 75 73 74 6F 6D 20 47 6C 79 70 68 20 46 6F
6E 74 43 75 73 74 6F 6D 20 46 6F 6E 74 63 75 73 74 6F 6D 00 00 00 01 8A 00 01 01 00 02 01 01 02
27 0E 9F 77 15 8B F9 50 05 F9 3C 8B 05 8B FD 50 05 FD 3C 8B 05 F7 2A F7 2A 15 8B F8 24 05 F8 10
8B 05 8B FC 24 05 0E 8B 8B 06 8B 8B 08 95 0A 95 0B F9 50 14 F9 50 14 00 00 00 00 00 02 A8 00 00
(自定义字体可以做得很小=)
但是,如果需要实际文件和/或 TTX 输出,可以在 https://github.com/Pomax/CFF-glyphlet-fonts/tree/gh-pages/binaries/test 找到它们,包括 TTX xml(直接链接:https://github.com/Pomax/CFF-glyphlet-fonts/blob/gh-pages/binaries/with%20GSUB/customfont.ttx),为了一个独立的问题,它是:
<?xml version="1.0" encoding="utf-8"?>
<ttFont sfntVersion="OTTO" ttLibVersion="2.4">
<GlyphOrder>
<!-- The 'id' attribute is only for humans; it is ignored when parsed. -->
<GlyphID id="0" name=".notdef"/>
<GlyphID id="1" name="custom"/>
</GlyphOrder>
<head>
<!-- Most of this table will be recalculated by the compiler -->
<tableVersion value="1.0"/>
<fontRevision value="1.0"/>
<checkSumAdjustment value="0x1aeaff64"/>
<magicNumber value="0x5f0f3cf5"/>
<flags value="00000000 00000000"/>
<unitsPerEm value="1024"/>
<created value="Thu Jan 01 00:00:00 1970"/>
<modified value="Thu Jan 01 00:00:00 1970"/>
<xMin value="20"/>
<yMin value="-20"/>
<xMax value="700"/>
<yMax value="680"/>
<macStyle value="00000000 00000000"/>
<lowestRecPPEM value="8"/>
<fontDirectionHint value="2"/>
<indexToLocFormat value="0"/>
<glyphDataFormat value="0"/>
</head>
<hhea>
<tableVersion value="1.0"/>
<ascent value="1004"/>
<descent value="-344"/>
<lineGap value="0"/>
<advanceWidthMax value="680"/>
<minLeftSideBearing value="0"/>
<minRightSideBearing value="0"/>
<xMaxExtent value="680"/>
<caretSlopeRise value="0"/>
<caretSlopeRun value="0"/>
<caretOffset value="0"/>
<reserved0 value="0"/>
<reserved1 value="0"/>
<reserved2 value="0"/>
<reserved3 value="0"/>
<metricDataFormat value="0"/>
<numberOfHMetrics value="2"/>
</hhea>
<maxp>
<tableVersion value="0x5000"/>
<numGlyphs value="2"/>
</maxp>
<OS_2>
<version value="3"/>
<xAvgCharWidth value="0"/>
<usWeightClass value="400"/>
<usWidthClass value="1"/>
<fsType value="00000000 00000000"/>
<ySubscriptXSize value="0"/>
<ySubscriptYSize value="0"/>
<ySubscriptXOffset value="0"/>
<ySubscriptYOffset value="0"/>
<ySuperscriptXSize value="0"/>
<ySuperscriptYSize value="0"/>
<ySuperscriptXOffset value="0"/>
<ySuperscriptYOffset value="0"/>
<yStrikeoutSize value="0"/>
<yStrikeoutPosition value="0"/>
<sFamilyClass value="0"/>
<panose>
<bFamilyType value="0"/>
<bSerifStyle value="0"/>
<bWeight value="0"/>
<bProportion value="0"/>
<bContrast value="0"/>
<bStrokeVariation value="0"/>
<bArmStyle value="0"/>
<bLetterForm value="0"/>
<bMidline value="0"/>
<bXHeight value="0"/>
</panose>
<ulUnicodeRange1 value="00000000 00000000 00000000 00000001"/>
<ulUnicodeRange2 value="00000000 00000000 00000000 00000000"/>
<ulUnicodeRange3 value="00000000 00000000 00000000 00000000"/>
<ulUnicodeRange4 value="00000000 00000000 00000000 00000000"/>
<achVendID value=" =) "/>
<fsSelection value="00000000 01000000"/>
<fsFirstCharIndex value="126"/>
<fsLastCharIndex value="126"/>
<sTypoAscender value="680"/>
<sTypoDescender value="-20"/>
<sTypoLineGap value="324"/>
<usWinAscent value="1004"/>
<usWinDescent value="344"/>
<ulCodePageRange1 value="00000000 00000000 00000000 00000001"/>
<ulCodePageRange2 value="00000000 00000000 00000000 00000000"/>
<sxHeight value="0"/>
<sCapHeight value="0"/>
<usDefaultChar value="0"/>
<usBreakChar value="126"/>
<usMaxContex value="0"/>
</OS_2>
<name>
<namerecord nameID="1" platformID="1" platEncID="32" langID="0x0">
Custom Font
</namerecord>
<namerecord nameID="2" platformID="1" platEncID="32" langID="0x0">
Regular
</namerecord>
<namerecord nameID="4" platformID="1" platEncID="32" langID="0x0">
Custom Glyph Font
</namerecord>
<namerecord nameID="5" platformID="1" platEncID="32" langID="0x0">
Version 1.0
</namerecord>
<namerecord nameID="1" platformID="3" platEncID="1" langID="0x409">
Custom Font
</namerecord>
<namerecord nameID="2" platformID="3" platEncID="1" langID="0x409">
Regular
</namerecord>
<namerecord nameID="4" platformID="3" platEncID="1" langID="0x409">
Custom Glyph Font
</namerecord>
<namerecord nameID="5" platformID="3" platEncID="1" langID="0x409">
Version 1.0
</namerecord>
</name>
<cmap>
<tableVersion version="0"/>
<cmap_format_4 platformID="3" platEncID="1" language="0">
<map code="0x7e" name="custom"/><!-- TILDE -->
</cmap_format_4>
</cmap>
<post>
<formatType value="3.0"/>
<italicAngle value="0.0"/>
<underlinePosition value="0"/>
<underlineThickness value="0"/>
<isFixedPitch value="1"/>
<minMemType42 value="0"/>
<maxMemType42 value="0"/>
<minMemType1 value="0"/>
<maxMemType1 value="0"/>
</post>
<CFF>
<CFFFont name="customfont">
<version value="Version 1.0"/>
<FullName value="Custom Glyph Font"/>
<FamilyName value="Custom Font"/>
<Weight value="Roman"/>
<isFixedPitch value="0"/>
<ItalicAngle value="0"/>
<UnderlineThickness value="50"/>
<PaintType value="0"/>
<CharstringType value="2"/>
<FontMatrix value="0.001 0 0 0.001 0 0"/>
<UniqueID value="1"/>
<FontBBox value="20 -20 700 680"/>
<StrokeWidth value="0"/>
<!-- charset is dumped separately as the 'GlyphOrder' element -->
<Encoding>
<map code="0x1" name="custom"/>
</Encoding>
<Private>
<BlueValues value="0 0"/>
<FamilyBlues value="0 0"/>
<BlueScale value="0.039625"/>
<BlueShift value="7"/>
<BlueFuzz value="1"/>
<StdHW value="10"/>
<StdVW value="10"/>
<ForceBold value="0"/>
<LanguageGroup value="0"/>
<ExpansionFactor value="0.06"/>
<initialRandomSeed value="0"/>
<defaultWidthX value="700"/>
<nominalWidthX value="0"/>
</Private>
<CharStrings>
<CharString name=".notdef">
endchar
</CharString>
<CharString name="custom">
20 -20 rmoveto
0 700 rlineto
680 0 rlineto
0 -700 rlineto
-680 0 rlineto
150 150 rmoveto
0 400 rlineto
380 0 rlineto
0 -400 rlineto
endchar
</CharString>
</CharStrings>
</CFFFont>
<GlobalSubrs>
<!-- The 'index' attribute is only for humans; it is ignored when parsed. -->
</GlobalSubrs>
</CFF>
<hmtx>
<mtx name=".notdef" width="0" lsb="0"/>
<mtx name="custom" width="680" lsb="0"/>
</hmtx>
</ttFont>
如果有任何其他工具可用于确定字体是否“完成”到足以安装,或者如果有人知道解释字体在安装之前需要满足哪些标准的文档,该信息非常受欢迎。当然,如果有人碰巧知道我的字体代码仍然缺少什么(作为字节码或作为 TTX XML),或者他们看到奇怪的/错误的位,我也对您的评论/答案非常感兴趣。
最佳答案
正如 Typophile 论坛上有人指出的那样,事实证明,就 Windows 而言,“名称”表是不完整的。虽然 Microsoft 字体验证器没有标记任何问题,但字体必须列出以下名称表条目才能安装:
1: the regular font name
2: the font subfamily ("Regular", etc)
3: any (seriously, ANY) string to act as a unique font identifier
6: the postscript font name (a subset of true ASCII. Not ANSI)
我定义的字体使用 NameIDs 1、2、4 和 5;虽然 4 和 5 实际上是“验证”所必需的,但事实证明它们与预览/安装完全无关,而 3 和 6 是关键。谁知道(说真的,谁知道......如果你知道,我想在聊天或推特上与你交谈或通过其他方式与你交谈=)
(请注意,仍然需要 4 和 5 才能在 OSX 上安装字体)
2017 年编辑:Microsoft 的字体验证器于 2015 年开源,由于 MS(出于法律原因)无法合并重要的社区贡献,因此建立了一个社区维护的分支,并且正在与 https://github.com/HinTak/Font-Validator 上的 OpenType 规范中的更改保持同步-- 如果 Font Validator 是您的工具集的一部分,您绝对想要开始使用这个分支。
关于windows - 可安装 OpenType 字体的 Windows 要求是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21801855/
类classAprivatedeffooputs:fooendpublicdefbarputs:barendprivatedefzimputs:zimendprotecteddefdibputs:dibendendA的实例a=A.new测试a.foorescueputs:faila.barrescueputs:faila.zimrescueputs:faila.dibrescueputs:faila.gazrescueputs:fail测试输出failbarfailfailfail.发送测试[:foo,:bar,:zim,:dib,:gaz].each{|m|a.send(m)resc
我需要在客户计算机上运行Ruby应用程序。通常需要几天才能完成(复制大备份文件)。问题是如果启用sleep,它会中断应用程序。否则,计算机将持续运行数周,直到我下次访问为止。有什么方法可以防止执行期间休眠并让Windows在执行后休眠吗?欢迎任何疯狂的想法;-) 最佳答案 Here建议使用SetThreadExecutionStateWinAPI函数,使应用程序能够通知系统它正在使用中,从而防止系统在应用程序运行时进入休眠状态或关闭显示。像这样的东西:require'Win32API'ES_AWAYMODE_REQUIRED=0x0
我有一个模型:classItem项目有一个属性“商店”基于存储的值,我希望Item对象对特定方法具有不同的行为。Rails中是否有针对此的通用设计模式?如果方法中没有大的if-else语句,这是如何干净利落地完成的? 最佳答案 通常通过Single-TableInheritance. 关于ruby-on-rails-Rails-子类化模型的设计模式是什么?,我们在StackOverflow上找到一个类似的问题: https://stackoverflow.co
我想为Heroku构建一个Rails3应用程序。他们使用Postgres作为他们的数据库,所以我通过MacPorts安装了postgres9.0。现在我需要一个postgresgem并且共识是出于性能原因你想要pggem。但是我对我得到的错误感到非常困惑当我尝试在rvm下通过geminstall安装pg时。我已经非常明确地指定了所有postgres目录的位置可以找到但仍然无法完成安装:$envARCHFLAGS='-archx86_64'geminstallpg--\--with-pg-config=/opt/local/var/db/postgresql90/defaultdb/po
我正在使用的第三方API的文档状态:"[O]urAPIonlyacceptspaddedBase64encodedstrings."什么是“填充的Base64编码字符串”以及如何在Ruby中生成它们。下面的代码是我第一次尝试创建转换为Base64的JSON格式数据。xa=Base64.encode64(a.to_json) 最佳答案 他们说的padding其实就是Base64本身的一部分。它是末尾的“=”和“==”。Base64将3个字节的数据包编码为4个编码字符。所以如果你的输入数据有长度n和n%3=1=>"=="末尾用于填充n%
我主要使用Ruby来执行此操作,但到目前为止我的攻击计划如下:使用gemsrdf、rdf-rdfa和rdf-microdata或mida来解析给定任何URI的数据。我认为最好映射到像schema.org这样的统一模式,例如使用这个yaml文件,它试图描述数据词汇表和opengraph到schema.org之间的转换:#SchemaXtoschema.orgconversion#data-vocabularyDV:name:namestreet-address:streetAddressregion:addressRegionlocality:addressLocalityphoto:i
为什么4.1%2返回0.0999999999999996?但是4.2%2==0.2。 最佳答案 参见此处:WhatEveryProgrammerShouldKnowAboutFloating-PointArithmetic实数是无限的。计算机使用的位数有限(今天是32位、64位)。因此计算机进行的浮点运算不能代表所有的实数。0.1是这些数字之一。请注意,这不是与Ruby相关的问题,而是与所有编程语言相关的问题,因为它来自计算机表示实数的方式。 关于ruby-为什么4.1%2使用Ruby返
我打算为ruby脚本创建一个安装程序,但我希望能够确保机器安装了RVM。有没有一种方法可以完全离线安装RVM并且不引人注目(通过不引人注目,就像创建一个可以做所有事情的脚本而不是要求用户向他们的bash_profile或bashrc添加一些东西)我不是要脚本本身,只是一个关于如何走这条路的快速指针(如果可能的话)。我们还研究了这个很有帮助的问题:RVM-isthereawayforsimpleofflineinstall?但有点误导,因为答案只向我们展示了如何离线在RVM中安装ruby。我们需要能够离线安装RVM本身,并查看脚本https://raw.github.com/wayn
我有一个奇怪的问题:我在rvm上安装了rubyonrails。一切正常,我可以创建项目。但是在我输入“railsnew”时重新启动后,我有“程序'rails'当前未安装。”。SystemUbuntu12.04ruby-v"1.9.3p194"gemlistactionmailer(3.2.5)actionpack(3.2.5)activemodel(3.2.5)activerecord(3.2.5)activeresource(3.2.5)activesupport(3.2.5)arel(3.0.2)builder(3.0.0)bundler(1.1.4)coffee-rails(
我刚刚为fedora安装了emacs。我想用emacs编写ruby。为ruby提供代码提示、代码完成类型功能所需的工具、扩展是什么? 最佳答案 ruby-mode已经包含在Emacs23之后的版本中。不过,它也可以通过ELPA获得。您可能感兴趣的其他一些事情是集成RVM、feature-mode(Cucumber)、rspec-mode、ruby-electric、inf-ruby、rinari(用于Rails)等。这是我当前用于Ruby开发的Emacs配置:https://github.com/citizen428/emacs