Skip to content

Instantly share code, notes, and snippets.

@karronoli
Last active May 6, 2018 04:31
Show Gist options
  • Save karronoli/59521be733aaaf485b3d67b0becc7519 to your computer and use it in GitHub Desktop.
Save karronoli/59521be733aaaf485b3d67b0becc7519 to your computer and use it in GitHub Desktop.
Download Access Runtime, Extract OCRB font, Install OCRB font.
Add-Type -AssemblyName System.Drawing
$code = @'
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Runtime.InteropServices;
public static class FontUtil {
[DllImport("gdi32.dll")]
public static extern int AddFontResource(string lpFilename);
}
'@
Add-Type $code
$ifc = New-Object -TypeName System.Drawing.Text.InstalledFontCollection
if (-not @($ifc.Families.Name).Contains("OCRB")) {
$origin = 'https://download.microsoft.com/download/E/7/6/E7654A3F-AE45-463E-9EAF-0526AC9C2CAE/accessruntime_4288-1001_x64_ja-jp.exe'
Invoke-WebRequest -Uri $origin -OutFile .\accessruntime_4288-1001_x64_ja-jp.exe
Start-Process .\accessruntime_4288-1001_x64_ja-jp.exe -ArgumentList '/extract:.\access','/quiet' -Wait
Start-Process expand -ArgumentList '-F:OCRB.TTF_1041','.\access\office.ja-jp\officelr.cab','.' -Wait
Rename-Item -Force OCRB.TTF_1041 OCRB.TTF
[FontUtil]::AddFontResource((Join-Path (pwd) 'OCRB.TTF'))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment