# 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

_LOGGER_NAME = common.LOGGER_NAME + "." + __name__
_LOGGER = logging.getLogger(_LOGGER_NAME)

FONT_TYPES = Enum("font01", "font02")
GAMES = Enum("dr", "sdr2")

LINE_HEIGHT   = {FONT_TYPES.font01: 25, FONT_TYPES.font02: 26}
MAX_HEIGHT    = 2048
HEIGHT_FACTOR = 128

# UNKNOWN1 is different for every font I've seen.
UNKNOWN1 = {
  GAMES.dr: {
    FONT_TYPES.font01: BitStream(hex = '0x2D000000'),
    FONT_TYPES.font02: BitStream(hex = '0x30000000'),
  },
  GAMES.sdr2: {
    FONT_TYPES.font01: BitStream(hex = '0x24000000'),
    FONT_TYPES.font02: BitStream(hex = '0x2D000000'),
  }
}

UNKNOWN2 = BitStream(hex = '0x01000000')

class FontData:
  def __init__(self):
    self.data = []
  
  def save(self, filename, font_type = FONT_TYPES.font01, game = GAMES.dr):

# 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


_LOGGER_NAME = common.LOGGER_NAME + "." + __name__
_LOGGER = logging.getLogger(_LOGGER_NAME)

FONT_TYPES = Enum("font01", "font02")
GAMES = Enum("dr", "sdr2")

LINE_HEIGHT   = {FONT_TYPES.font01: 25, FONT_TYPES.font02: 26}
MAX_HEIGHT    = 2048
HEIGHT_FACTOR = 128

# UNKNOWN1 is different for every font I've seen.
UNKNOWN1 = {
  GAMES.dr: {
    FONT_TYPES.font01: BitStream(hex = '0x2D000000'),
    FONT_TYPES.font02: BitStream(hex = '0x30000000'),
  },
  GAMES.sdr2: {
    FONT_TYPES.font01: BitStream(hex = '0x24000000'),
    FONT_TYPES.font02: BitStream(hex = '0x2D000000'),
  }
}

UNKNOWN2 = BitStream(hex = '0x01000000')

class FontData:
  def __init__(self):
    self.data = []
  
  def save(self, filename, font_type = FONT_TYPES.font01, game = GAMES.dr):

    data = BitStream(SPFT_MAGIC)