Advertisement
esepich

Untitled

Jul 10th, 2015
442
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.62 KB | None
  1. # Filename: fonttopng.ps1
  2.  
  3. $sOutputDir = "C:\Users\erics_000\Desktop\Output"
  4. $sCharsDir = "$sOutputDir\Chars"
  5. $sCombDir = "$sOutputDir\Comb"
  6. $sImageMagickHome = "C:\ImageMagick"
  7. $sImageMagickConv = "$sImageMagickHome\convert.exe"
  8. $sImageMagickArgs = @('-background', 'transparent',
  9. '-fill', 'hsb(0,0,0)',
  10. '-font', 'Arial',
  11. '-pointsize', '18',
  12. '-size', '18x26',
  13. '-gravity', 'center')
  14.  
  15. New-Item -ItemType Directory -Force -Path $sOutputDir
  16. New-Item -ItemType Directory -Force -Path $sCharsDir
  17. New-Item -ItemType Directory -Force -Path $sCombDir
  18.  
  19. for ( $i = 0x0020; $i -le 0x007F; $i++ )
  20. {
  21. $sCurChar = [char]$i
  22. $sCurLabel = [string]$sCurChar
  23.  
  24. If ($sCurLabel -contains """")
  25. {
  26. Write-Host "replacing..."
  27. $sCurLabel = $sCurLabel.replace("""","\""")
  28. }
  29.  
  30. If ($sCurLabel -contains "\")
  31. {
  32. Write-Host "replacing..."
  33. $sCurLabel = $sCurLabel.replace("\","\")
  34. }
  35.  
  36. $sCurFileName = [string] "{00:X000000}" -f $i+".png"
  37.  
  38. $sImageMagickArgs = @('-background', 'transparent',
  39. '-fill', 'hsb(0,0,0)',
  40. '-font', 'Arial',
  41. '-pointsize', '18',
  42. '-size', '18x26',
  43. '-gravity', 'center',
  44. "label:""$sCurLabel""",
  45. "$sCharsDir\$sCurFileName")
  46.  
  47. If($sCurLabel -contains " ")
  48. {
  49.  
  50. }
  51. ElseIf($sCurLabel -contains "")
  52. {
  53.  
  54. }
  55. Else
  56. {
  57. Write-Host $sImageMagickConv $sImageMagickArgs
  58.  
  59. & $sImageMagickConv $sImageMagickArgs
  60. }
  61.  
  62. }
  63.  
  64. # end of script
Advertisement
RAW Paste Data Copied
Advertisement