readFFValue ffmap s 
  | "/uni" `isPrefixOf` s && "dup1" `isSuffixOf` s = Dup (unicode s) 1
  | "/uni" `isPrefixOf` s && "dup2" `isSuffixOf` s = Dup (unicode s) 2
  | "/uni" `isPrefixOf` s && "vert" `isSuffixOf` s = Vert (unicode s)
  | "/uni" `isPrefixOf` s && "hw" `isSuffixOf` s = Hw (unicode s)
  | "/uni" `isPrefixOf` s = Uni (unicode s) 
  | "/Japan1" `isPrefixOf` s && "vert" `isSuffixOf` s = Vert (jpncode s)
  | "/Japan1" `isPrefixOf` s && "hw" `isSuffixOf` s = Hw (jpncode s)
  | "/Japan1" `isPrefixOf` s = Uni (jpncode s)
  | "," `isInfixOf` s = let (a,b) = break (==',') s
                        in  Variation [hexcode (dropWhile (==',') b), hexcode a]
  | "/.notdef" == s = NOTDEF
  | otherwise = Uni (hexcode s)
  where cidcode s = case find ((s++" ") `isPrefixOf`) ffmap of
          Just e -> (fromFFC . snd) $ expandEntry [] e
          Nothing -> ' '  -- error $ "No CID code for "++s     
        hexcode = chr . fst . head . readHex
        unicode = hexcode . takeWhile isHexDigit . (\\ "/uni")
        jpncode = cidcode . takeWhile isDigit . (\\ "/Japan1.")
readFFValue ffmap s 
  | "/uni" `isPrefixOf` s && "dup1" `isSuffixOf` s = Dup (unicode s) 1
  | "/uni" `isPrefixOf` s && "dup2" `isSuffixOf` s = Dup (unicode s) 2
  | "/uni" `isPrefixOf` s && "vert" `isSuffixOf` s = Vert (unicode s)
  | "/uni" `isPrefixOf` s && "hw" `isSuffixOf` s = Hw (unicode s)
  | "/uni" `isPrefixOf` s = Uni (unicode s) 
  | "/Japan1" `isPrefixOf` s && "vert" `isSuffixOf` s = Vert (jpncode s)
  | "/Japan1" `isPrefixOf` s && "hw" `isSuffixOf` s = Hw (jpncode s)
  | "/Japan1" `isPrefixOf` s = Uni (jpncode s)
  | "," `isInfixOf` s = let (a,b) = break (==',') s
                        in  Variation [hexcode (dropWhile (==',') b), hexcode a]
  | "/.notdef" == s = NOTDEF
  | otherwise = Uni (hexcode s)
  where cidcode s = case find ((s++" ") `isPrefixOf`) ffmap of
          Just e -> (fromFFC . snd) $ expandEntry [] e
          Nothing -> ' '  -- error $ "No CID code for "++s     
        hexcode = chr . fst . head . readHex
        unicode = hexcode . takeWhile isHexDigit . (\\ "/uni")
        jpncode = cidcode . takeWhile isDigit . (\\ "/Japan1.")
readFFValue ffmap s 
  | "/uni" `isPrefixOf` s && "dup1" `isSuffixOf` s = Dup (unicode s) 1
  | "/uni" `isPrefixOf` s && "dup2" `isSuffixOf` s = Dup (unicode s) 2
  | "/uni" `isPrefixOf` s && "vert" `isSuffixOf` s = Vert (unicode s)
  | "/uni" `isPrefixOf` s && "hw" `isSuffixOf` s = Hw (unicode s)
  | "/uni" `isPrefixOf` s = Uni (unicode s) 
  | "/Japan1" `isPrefixOf` s && "vert" `isSuffixOf` s = Vert (jpncode s)
  | "/Japan1" `isPrefixOf` s && "hw" `isSuffixOf` s = Hw (jpncode s)
  | "/Japan1" `isPrefixOf` s = Uni (jpncode s)
  | "," `isInfixOf` s = let (a,b) = break (==',') s
                        in  Variation [hexcode (dropWhile (==',') b), hexcode a]
  | "/.notdef" == s = NOTDEF
  | otherwise = Uni (hexcode s)
  where cidcode s = case find ((s++" ") `isPrefixOf`) ffmap of
          Just e -> (fromFFC . snd) $ expandEntry [] e
          Nothing -> ' '  -- error $ "No CID code for "++s     
        hexcode = chr . fst . head . readHex
        unicode = hexcode . takeWhile isHexDigit . (\\ "/uni")
        jpncode = cidcode . takeWhile isDigit . (\\ "/Japan1.")