# Path: font_parser.py
# SPFT_MAGIC     = ConstBitStream(hex='0x7446705304000000')


from PyQt4 import QtCore, QtGui, Qt
from PyQt4.QtGui import QFont, QFontMetrics, QImage, QPainter, QPainterPath, QColor
from bitstring import BitStream
from enum import Enum
from font_parser import SPFT_MAGIC
import logging
import math
import os
import sys
import common
    self.opaque = QImage(width, MAX_HEIGHT, QImage.Format_ARGB32_Premultiplied)
    self.opaque.fill(QColor(0, 0, 0, 255).rgba())
    
    self.font_data = FontData()
  
  def save(self, directory, name, for_game = True, for_editor = True, font_type = FONT_TYPES.font01, game = GAMES.dr):
    # name = str(font_type)
    
    if for_editor:
      self.trans.save(os.path.join(directory, name + ".png"))
    
    if for_game:
      opaque_gray = to_gray(self.opaque)
      opaque_gray.save(os.path.join(directory, name + ".bmp"))
    
    self.font_data.save(os.path.join(directory, name + ".font"), font_type, game)

class FontConfig:
  def __init__(self, family = "Meiryo", size = 11, weight = 50,
      x_offset = 0, y_offset = 2, x_margin = 2, y_margin = 2,
      y_shift = -1, pen_size = 0, pen_cap = Qt.Qt.RoundCap,
      pen_join = Qt.Qt.RoundJoin, use_pen = False, chars = "",
      subs = {u"\t": u'  '}):
    
    self.family   = family
    self.size     = size
    self.weight   = weight
    self.x_offset = x_offset
    self.y_offset = y_offset
    self.x_margin = x_margin

# Path: font_parser.py
# SPFT_MAGIC     = ConstBitStream(hex='0x7446705304000000')


# Path: font_generator.py
from PyQt4 import QtCore, QtGui, Qt
from PyQt4.QtGui import QFont, QFontMetrics, QImage, QPainter, QPainterPath, QColor
from bitstring import BitStream
from enum import Enum
from font_parser import SPFT_MAGIC
import logging
import math
import os
import sys
import common

    self.opaque = QImage(width, MAX_HEIGHT, QImage.Format_ARGB32_Premultiplied)
    self.opaque.fill(QColor(0, 0, 0, 255).rgba())
    
    self.font_data = FontData()
  
  def save(self, directory, name, for_game = True, for_editor = True, font_type = FONT_TYPES.font01, game = GAMES.dr):
    # name = str(font_type)
    
    if for_editor:
      self.trans.save(os.path.join(directory, name + ".png"))
    
    if for_game:
      opaque_gray = to_gray(self.opaque)
      opaque_gray.save(os.path.join(directory, name + ".bmp"))
    
    self.font_data.save(os.path.join(directory, name + ".font"), font_type, game)

class FontConfig:
  def __init__(self, family = "Meiryo", size = 11, weight = 50,
      x_offset = 0, y_offset = 2, x_margin = 2, y_margin = 2,
      y_shift = -1, pen_size = 0, pen_cap = Qt.Qt.RoundCap,
      pen_join = Qt.Qt.RoundJoin, use_pen = False, chars = "",
      subs = {u"\t": u'  '}):
    
    self.family   = family
    self.size     = size
    self.weight   = weight
    self.x_offset = x_offset
    self.y_offset = y_offset
    self.x_margin = x_margin

    self.y_margin = y_margin