LoginSignup
2
2

More than 5 years have passed since last update.

migu-1m フォントの「波ダッシュ」字形の修正

Last updated at Posted at 2014-09-23

こんにちは。


migu-1m フォント migu-1m-20150712.zip 版では、「波ダッシュ」(0u301c) が適切な字形へ修正され、したがって本稿のような自力作業は不要のようです。


migu-1m フォントは、「波ダッシュ」(0u301c) がひっくり返った字形を採用しているので、適切な字形へ修正。fontforge コマンドを利用し、「全角チルダ」の字形を利用。

#!/bin/sh
for f in "migu-1m-regular.ttf migu-1m-bold.ttf"
do
  fontforge -c 'Open($1);Select(0uff5e);Copy();Select(0u301c);Paste();Save();' $f
done

もしくは、

#!/usr/bin/env fontforge -script
# http://iij.dl.sourceforge.jp/mix-mplus-ipa/59022/migu-1m-20130617.zip

flist = ["migu-1m-regular.ttf", "migu-1m-bold.ttf"]
i = 0
while (i < SizeOf(flist))
  Open(flist[i])
  Select(0uff5e) # fullwidth tilde
  Copy()
  Select(0u301c) # wave dash
  Paste()
  Generate(flist[i])
  Print(flist[i] + " is overwritten.")
  Close()
  i += 1
endloop

また「プログラミング用フォント Ricty」の ricty_generator.sh と misc/glyph_replacer.pe (字形修正用) とを用いて Ricty フォント作成の homebrew の formula を書くと(ほぼ homebrew-font そのものですが)、

require 'formula'

class InconsolataFonts < Formula
  homepage 'http://levien.com/type/myfonts/inconsolata.html'
  url 'http://levien.com/type/myfonts/Inconsolata.otf'
  sha1 '7f0a4919d91edcef0af9dc153054ec49d1ab3072'
  version '1.0.0'
end

class Migu1MFonts < Formula
  homepage 'http://mix-mplus-ipa.sourceforge.jp/'
  version '20130617'
  sha1 'a0641894cec593f8bb1e5c2bf630f20ee9746b18'
  url "http://sourceforge.jp/frs/redir.php?m=iij&f=%2Fmix-mplus-ipa%2F59022%2Fmigu-1m-#{version}.zip"
end

class Ricty < Formula
  homepage 'https://github.com/yascentur/Ricty'
  version '3.2.4'
  sha1 '7fc8adcc74656d9e2e1acd325de82f0f08a6d222'
  url "https://github.com/yascentur/Ricty/archive/#{version}.tar.gz"

  depends_on 'fontforge'

  def install
    share_fonts = share+'fonts'

    Formula['inconsolata-fonts'].brew { share_fonts.install Dir['*'] }
    Formula['migu1-m-fonts'].brew { share_fonts.install Dir['*'] }

    ['migu-1m-regular.ttf', 'migu-1m-bold.ttf'].each do |f|
        system './misc/glyph_replacer.pe', share_fonts + f, '0u301c', '0uff5e'
    end

    system 'sh', './ricty_generator.sh', share_fonts+'Inconsolata.otf',
                                         share_fonts+'migu-1m-regular.ttf',
                                         share_fonts+'migu-1m-bold.ttf'

    share_fonts.install Dir['Ricty*.ttf']
  end

  test do
    system "false"
  end

  def caveats; <<-EOS.undent
    ***************************************************
    Generated files:
      #{Dir[share+'fonts/Ricty*.ttf'].join("\n      ")}
    ***************************************************
    To install Ricty:
      $ cp -f #{share}/fonts/Ricty*.ttf ~/Library/Fonts/
      $ fc-cache -vf
    ***************************************************
    EOS
  end
end
2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2