JP2004219937A - Font processing device, terminal device, font processing method and font processing program - Google Patents

Font processing device, terminal device, font processing method and font processing program Download PDF

Info

Publication number
JP2004219937A
JP2004219937A JP2003009909A JP2003009909A JP2004219937A JP 2004219937 A JP2004219937 A JP 2004219937A JP 2003009909 A JP2003009909 A JP 2003009909A JP 2003009909 A JP2003009909 A JP 2003009909A JP 2004219937 A JP2004219937 A JP 2004219937A
Authority
JP
Japan
Prior art keywords
size
font
character data
processing
enlargement
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Withdrawn
Application number
JP2003009909A
Other languages
Japanese (ja)
Inventor
Takashi Kurumisawa
孝 胡桃澤
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Seiko Epson Corp
Original Assignee
Seiko Epson Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Seiko Epson Corp filed Critical Seiko Epson Corp
Priority to JP2003009909A priority Critical patent/JP2004219937A/en
Publication of JP2004219937A publication Critical patent/JP2004219937A/en
Withdrawn legal-status Critical Current

Links

Images

Landscapes

  • Document Processing Apparatus (AREA)
  • Controls And Circuits For Display Device (AREA)
  • Record Information Processing For Printing (AREA)

Abstract

<P>PROBLEM TO BE SOLVED: To produce natural fonts of characters of various forms and sizes by using small capacity by taking the size of displayed fonts into consideration when a bit-mapped fonts used in a cellular phone or a personal digital assistant (PDA) or the like are enlarged or reduced. <P>SOLUTION: First, a font processing device stores the font data of the bit-mapped font as matrix data. The font processing device then acquires size designation information, and compares an optionally set standard size with the size contained in the size designation information. Further, the font processing device acquires the matrix data on the basis of the size contained in the size designation information, and performs magnification or shrinkage of the acquired matrix data on the basis of the comparison result and the size. Thereby the natural font of characters of an optional size can be produced. <P>COPYRIGHT: (C)2004,JPO&NCIPI

Description

【0001】
【発明の属する技術分野】
本発明は、ビットマップフォントの拡大、縮小処理に関する。
【0002】
【背景技術】
携帯電話やPDA(Personal Digital Assistant)などの装置では文字などの表示にビットマップフォントが使用される。ビットマップフォントは、予め用意された画素の配列パターンにより文字や記号といったフォントを表示するものである。ベクトルデータの集合として文字や記号などを表示するアウトラインフォントと異なり、ビットマップフォントは単純な画素の配列パターンであるため、1文字当たりのデータ量が小さい。そのため、PC(Personal Computer)と比較してメモリの容量が少なく、処理能力の低い携帯電話やPDAなどにおいては、ビットマップフォントが使用される。
【0003】
近年、携帯電話やPDAに使用される表示エリアの画素数は増加の一途を辿っており、ビットマップフォントを使用して様々な字体、大きさのフォントをユーザに提供する必要性が高くなってきている。このような要求の対応策として、予め記憶されたビットマップフォントである元データに基づき、サイズの拡大や縮小を行うことで様々な字体、大きさのフォントをユーザに提供することが提案されている(例えば、特許文献1、特許文献2参照)。
【0004】
【特許文献1】
特開平8−63147号公報
【特許文献2】
特開平7−156450号公報
【0005】
【発明が解決しようとする課題】
しかし、携帯電話やPDAなどで表示される比較的サイズの小さいフォントは、太さが1画素で表されることも多い。よって、所定のサイズ未満の小さなフォントを表示する場合、ビットマップフォントの元データのサイズと拡大後のサイズとの縦横比であるアドレスに基づいて座標変換を行う手法により当該元データを拡大すると、拡大後のフォントに不自然な太さの部分ができてしまうことがある。また、同様の小さなフォントを上記のようなアドレスに基づく座標変換により縮小すると、縮小後に不自然な太さの線ができたり、フォントを構成する線分の部分同士が不適切に連結したりしてフォントが潰れてしまうことがある。
【0006】
一方、所定のサイズ以上の大きなフォントを表示する場合、アドレスに基づく座標変換を行う手法によりビットマップフォントの元データの拡大や縮小をすることで、容易にバランスの良い文字を生成することができる。
【0007】
本発明は、以上の点に鑑みてなされたものであり、携帯電話やPDAなどで使用するビットマップフォントを拡大・縮小する際に、表示するフォントのサイズを考慮することにより、少ない容量で様々な字体、大きさの自然なフォントを生成することを目的とする。
【0008】
【課題を解決するための手段】
本発明の1つの観点では、ビットマップフォントのフォントデータを字母データとして記憶する字母データ記憶手段と、指定されたフォントのサイズを含むサイズ指定情報を取得するサイズ指定情報取得手段と、前記サイズ指定情報に含まれる前記サイズと基準サイズを比較するサイズ比較手段と、前記サイズ指定情報に含まれる前記サイズに基づいて、前記字母データ記憶手段が記憶した前記字母データを取得する字母データ取得手段と、前記サイズ比較手段の比較結果及び前記サイズに基づいて、前記字母データ取得手段が取得した前記字母データを拡大又は縮小する拡大/縮小手段と、を備える。
【0009】
また、同様の観点によるフォント処理方法は、ビットマップフォントのフォントデータを字母データとして記憶する字母データ記憶工程と、指定されたフォントのサイズを含むサイズ指定情報を取得するサイズ指定情報取得工程と、前記サイズ指定情報に含まれる前記サイズと基準サイズを比較するサイズ比較工程と、前記サイズ指定情報に含まれる前記サイズに基づいて、前記字母データ記憶手段が記憶した前記字母データを取得する字母データ取得工程と、前記サイズ比較手段の比較結果及び前記サイズに基づいて、前記字母データ取得手段が取得した前記字母データを拡大又は縮小する拡大/縮小工程と、を有する。
【0010】
上記のフォント処理装置又は方法は、まず、ビットマップフォントのフォントデータを字母データとして記憶する。そして、フォント処理装置又は方法は、サイズ指定情報を取得する。ここで、サイズ指定情報は、フォント処理装置を使用するユーザが任意に指定するサイズやフォント処理装置が自動的に指定するサイズの情報を含んでいる。次に、フォント処理装置又は方法は、サイズ指定情報に含まれるサイズと、任意に設定された基準サイズとを比較する。また、フォント処理装置又は方法は、サイズ指定情報に含まれるサイズに基づいて字母データを取得する。さらに、フォント処理装置又は方法は、比較結果及び当該サイズに基づいて取得した字母データの拡大又は縮小を行う。
【0011】
これによれば、指定されたサイズに応じた適切な処理により字母データの拡大又は縮小を行うことができる。よって、バランスの整った自然なフォントを生成することができる。また、字母データを拡大又は縮小することにより、任意の大きさのフォントを生成することができる。よって、指定される可能性のある全てのサイズのフォントを予め記憶しておく必要がなく、メモリの使用容量を大幅に節約することができる。
【0012】
上記のフォント処理装置の他の一態様では、前記拡大/縮小手段は、前記サイズ比較手段の比較結果、前記サイズ指定情報に含まれる前記サイズが前記基準サイズより小さい場合に、前記字母データの画素構成の特徴を示すコストに基づいて前記字母データを拡大又は縮小するコスト方式拡大/縮小手段と、前記サイズ比較手段の比較結果、前記サイズ指定情報に含まれる前記サイズが前記基準サイズより大きい場合に、前記字母データの縦横比であるアドレスに基づいて座標を変換することにより前記字母データを拡大又は縮小するアドレス方式拡大/縮小手段と、をさらに備える。
【0013】
上記のフォント処理装置は、サイズ指定情報に含まれるサイズが任意に設定される基準サイズより小さい場合、コスト方式拡大/縮小手段により字母データの拡大又は縮小を行う。ここで、コスト方式拡大/縮小手段について具体的に説明する。フォント処理装置は、まず、取得した字母データを縦方向に分析し、当該字母データを構成する画素の縦方向の画素構成を数値化したコストを算出する。そして、その分析結果であるコスト基づいて字母データを横方向に拡大又は縮小する。同様に、フォント処理装置は、字母データを横方向に分析し、当該字母データを構成する画素の横方向の画素構成を数値化したコストを算出する。そして、その分析結果であるコストに基づいて字母データを縦方向に拡大又は縮小を行う。
【0014】
一方、サイズ指定情報に含まれるサイズが任意に設定される基準サイズより大きい場合、アドレス方式拡大/縮小手段により字母データの拡大又は縮小を行う。ここで、アドレス方式拡大/縮小手段について具体的に説明する。フォント処理装置は、まず、取得した字母データのサイズとサイズ指定情報に含まれるサイズとの縦横比を、所定の座標に基づいたアドレスとして算出する。そして、フォント処理装置は、算出したアドレスに基づいて字母データの座標変換を行うことにより拡大又は縮小を行う。
【0015】
これによれば、比較的小さいサイズのフォントは、コスト方式処理により字母データの拡大又は縮小を行うことで、不自然な太さの線が出現することなく生成することが可能となる。一方、比較的大きいサイズのフォントは、アドレス方式処理により字母データの拡大又は縮小を行うことで、バランスの整った自然なフォントを容易に生成することができる。
【0016】
上記フォント処理装置のさらに他の一態様では、前記字母データ記憶手段は、複数のサイズ及び/又は複数のデザインのフォントデータを前記字母データとして記憶しており、前記基準サイズは、前記デザインの判別が可能なサイズである。
【0017】
これによれば、フォント処理装置は、指定されたサイズがデザインの判別が可能なサイズより小さい場合、コスト方式処理により、フォントのデザインを正確に表現することよりも、フォントが潰れたり不自然な太さの線が出現したりしないことを重視したフォントを生成することができる。一方、指定されたサイズがデザインの判別が可能なサイズより大きい場合、フォント処理装置は、アドレス方式処理により、デザインの正確な表現が可能であり自然なフォントを生成することができる。よって、指定された任意のサイズ、デザインでバランスの整ったフォントを生成することができる。
【0018】
本発明の他の観点では、上記のフォント処理装置と、前記フォント処理装置により生成されたフォントデータを記憶する記憶手段と、前記フォント処理装置により生成されたフォントデータを表示する表示部とを備える端末装置を構成することができる。当該端末装置は、例えば携帯電話やPDAなどの携帯型端末装置とすることができる。本発明のフォント処理装置により、指定されたフォントのサイズを考慮した字母データの拡大や縮小ができるので、そのような携帯型端末装置においてもバランスの整った自然なフォントを生成し、表示することができる。
【0019】
本発明のさらに他の観点では、コンピュータを備える端末装置において実行されるフォント処理プログラムであって、前記コンピュータを、ビットマップフォントのフォントデータを字母データとして記憶する字母データ記憶手段、指定されたフォントのサイズを含むサイズ指定情報を取得するサイズ指定情報取得手段、前記サイズ指定情報に含まれる前記サイズと基準サイズを比較するサイズ比較手段、前記サイズ指定情報に含まれる前記サイズに基づいて、前記字母データ記憶手段が記憶した前記字母データを取得する字母データ取得手段、前記サイズ比較手段の比較結果に基づいて、前記字母データ取得手段が取得した前記字母データを拡大又は縮小する拡大/縮小手段、として機能させる。
【0020】
上記のフォント処理プログラムを、端末装置内のコンピュータで実行することにより、上記のフォント処理装置を実現することができる。
【0021】
【発明の実施の形態】
以下、図面を参照して本発明の好適な実施の形態について説明する。
【0022】
[携帯端末装置の構成]
図1に、本発明の実施形態にかかるビットマップフォントの拡大・縮小処理を適用した携帯端末装置の概略構成を示す。図1において、携帯端末装置10は、例えば携帯電話やPDAなど、画像表示エリアが比較的小さい端末装置である。携帯端末装置10は、表示部12と、処理フォントメモリ14と、CPU16と、入力部18と、プログラムROM20と、フォントROM22と、RAM24とを備える。
【0023】
表示部12は、例えばLCD(Liquid Crystal Display:液晶表示装置)などの軽量、薄型の表示装置とすることができ、表示エリア内にビットマップフォントにより構成される文字や記号といったフォントを表示する。
【0024】
入力部18は、携帯電話であれば各種の操作ボタンなど、PDAであればタッチペンなどによる接触を検出するタブレットなどにより構成することができ、ユーザが各種の指示、指定、選択等を行う際に使用される。具体的には、ユーザが表示部12の表示エリア内に表示する表示フォントのサイズを指定する際に使用される。入力部18に対して入力された指示や指定等は、電気信号に変換されてCPU16へ送られる。なお、表示フォントのサイズを指定する方法としては、ドットの数値を直接入力する方法、複数の選択肢の中から指定する方法等種々の方法を適用することができる。
【0025】
プログラムROM20は、携帯端末装置10の各種機能を実行するための各種プログラムを記憶し、特に本実施形態ではビットマップフォントの拡大・縮小プログラム(以下、「フォント拡大・縮小プログラム」と呼ぶ。)、ビットマップフォントを利用したフォントの表示プログラムなどを記憶している。フォント拡大・縮小プログラムは、コスト方式処理プログラム及びアドレス方式処理プログラムの2種類を有している。詳細は後述するが、ユーザが指定したサイズが19ドット未満の場合、コスト方式処理プログラムに基づいてコスト方式処理によりフォントの拡大・縮小が行われる。一方、ユーザが指定したサイズが19ドット以上の場合、アドレス方式処理プログラムに基づいてアドレス方式処理によりフォントの拡大縮小が行われる。
【0026】
フォントROM22は、ビットマップフォントの元データ(「字母データ」とも呼ぶ。)を記憶する。なお、本実施形態では、サイズが12、16、20、24、28及び32ドットの字母データが予め記憶されているものとする。ここで、字母データは、例えば12×12ドットなどの、縦横比が等しいフォント(「正方フォント」とも呼ぶ。)とすることが一般的である。
【0027】
RAM24は、ビットマップフォントの拡大・縮小プログラムに従って字母データを拡大・縮小処理する際に作業用メモリとして使用される。一方、処理フォントメモリ14は、ビットマップフォントの拡大・縮小プログラムによって拡大又は縮小処理により作成されたフォント(以下、「処理フォント」とも呼ぶ。)を一時的に記憶するメモリである。処理フォントは、後述するCPU16により表示フォントとして表示される。処理フォントメモリ14は、通常、RAMやフラッシュメモリなどにより構成することができ、携帯端末装置10が電源オフされるまで記憶内容を保持する。
【0028】
CPU16は、プログラムROM20内に記憶されている各種プログラムを実行することにより、携帯端末装置10の各種機能を実行する。特に、本実施形態では、プログラムROM20内に記憶されている文字表示プログラムを読み出して実行することにより、所定の表示フォントを表示部12上に表示させる。また、同じくプログラムROM20内に記憶されているフォント拡大・縮小プログラムを読み出して実行することにより、フォントROM22内に記憶されている字母データを拡大、縮小して処理フォントを生成する。なお、CPU16は、これら以外に各種のプログラムを実行することにより携帯端末装置10の各種機能を実現するが、それらは本発明とは直接の関連を有しないので、説明を省略する。
【0029】
[コスト方式処理]
次に、ユーザが指定したサイズが19ドット未満の場合に行われるコスト方式処理によるフォントの拡大・縮小について説明する。コスト方式処理は、前述のようにCPU16がプログラムROM20内に格納されているコスト方式処理プログラムを実行することにより行われる。以下、コスト方式処理によりフォントを拡大する場合、及び、コスト方式処理によりフォントを縮小する場合について、順に説明する。
【0030】
(i)コスト方式処理によりフォントを拡大する場合
まず、コスト方式処理によりフォントを拡大する場合について図2乃至図7を参照して説明する。図2乃至図4はコスト方式処理によりフォントを拡大する場合のメインルーチン及びサブルーチンのフローチャートである。また、図5乃至図7はコスト方式処理によりフォントを拡大する場合の各工程を説明するための図である。
【0031】
図2を参照すると、まずCPU16はサイズ指定情報を受け取る(ステップS1)。サイズ指定情報は、例えばユーザが入力部18を操作して表示フォントのサイズの指定、選択や表示モードの指定、選択を行った場合に、入力部18からの指示に基づいて生成される。また、ユーザによる指示以外の場合でも、表示部12上への表示内容に応じてサイズが指定される場合もある。例えば、表示エリア内に特定の文字データを表示する際に、文字表示プログラムが自動的にフォントのサイズを要求する場合もある。
【0032】
なお、コスト方式処理による拡大を行う場合に受け取るサイズ指定情報は、19ドット未満であり、且つ、字母データを拡大することにより最も効率的に生成することが可能なサイズの情報である。具体的には、指定されたサイズが13ドットの場合、12ドットの字母データを拡大することで最も効率良く13ドットのフォントを生成することができる。よって、このような場合、サイズ指定情報として13ドットを受け取り、CPU16は、コスト方式処理による拡大を行う。しかし、指定されたサイズが15ドットの場合、12ドットの字母データを拡大するよりも、16ドットの字母データを縮小する方が効率的に15ドットのフォントを生成することができる。よって、このような場合、CPU16は、後述するコスト方式処理による縮小を行う。
【0033】
サイズ指定情報を受け取ると、CPU16は指定されたサイズに最も近い字母データをフォントROM22から読み出し、作業メモリであるRAM24へ展開する(ステップS2)。具体的に、指定されたサイズが13ドットの場合、12ドットの字母データを読み出す。一方、指定されたサイズが17ドットの場合、16ドットの字母データを読み出す。
【0034】
次に、CPU16は行方向拡大処理を実行して、字母データを展開した拡大の対象となるフォントをまず行方向に拡大し(ステップS3)、次に列方向拡大処理を実行して、行方向に拡大されたフォントをさらに列方向に拡大する(ステップS4)。なお、本例の場合、行方向の拡大率と列方向の拡大率は同一に設定される。こうして、行方向及び列方向にフォントの拡大が完了すると、CPU16は拡大後のフォントデータを処理フォントとして処理フォントメモリ14に一時的に保存し(ステップS5)、さらに表示部12上に表示フォントとして表示する(ステップS6)。こうして、特定の字母データに基づいて対象となるフォントの拡大が行われ、指定されたサイズの処理フォントが表示フォントとして表示部12上に表示される。
【0035】
次に、ステップS3で行われる行方向拡大処理の詳細について図3のフローチャートを参照して説明する。図3において、まずCPU16は、対象となるフォントを複数の行に分割する(ステップS11)。そして、CPU16は、分割により得られた行ごとに、コストを計算する(ステップS12)。ここで、コストとは、フォントを構成する画素の数及び隣接する画素の有無などにより求められる値であり、フォント拡大処理においては線分量を示す。即ち、コストが大きいほど、その行には点や点の集合ではなく、線分が含まれている度合いが高いことを意味する。
【0036】
図4に、ステップS12におけるコスト計算処理の詳細を示す。コスト計算処理では、まず、図5(a)に示すように、行単位でフォント構成画素の数をカウントする(ステップS21)。図5(a)において、各行の下に示した数字(左から、0、4、3、3、…)が各行のコストを示している。
【0037】
次に、図5(b)に示すように、隣接するフォント構成画素を有する画素分の加算を行う(ステップS22)。図5(b)の例では、隣接するフォント構成画素を有するフォント構成画素ごとに、コストに「2」を加算している。こうして、隣接画素分のコストを加算した結果得られる各行のコストが各行の下に示されている。隣接する画素を有する画素についてコストを加算することにより、その行に存在するフォント構成画素が点であるのか、線分に近いのかをある程度区分することができる。即ち、1つの行に含まれるフォント構成画素数が同じであっても、コストが大きい行ほど、その行に含まれるフォント構成画素は線分に近いということが言える。そして、後述のように、コスト値の大きい行、つまり線分に近い行ほど拡大されにくくする。
【0038】
次に、図6(a)に示すように、スペースを考慮した重み付け処理を行う(ステップS23)。具体的には、各行について、両端の画素がスペース(フォント構成画素が存在しない。図5及び6ではスペースで示されている。)である場合には、コスト値を「+2」する。また、両端の画素の1画素内側の画素がスペースである場合、コスト値を「+1」する。この処理は、文字としてのバランス及び文字を横方向に並べて文にした場合のバランスの面を考慮している。例えば平仮名の「し」という文字などは、普通に拡大すると左右の空きの部分だけが拡大されてしまい、文字を構成する中央のフォント構成画素はあまり拡大されない。その結果、拡大後の文章として見ると、他の文字は拡大されているが、文字「し」だけはフォント構成部分が十分に拡大されていないため、小さいままに見えてしまう。このような不具合を防止するために、スペースを考慮した重み付けを行うのである。この処理の結果、上下端にスペースを有する行はコスト値が大きくなり、拡大されにくくなる。
【0039】
次に、同一コスト値を有する行の重み付け処理を行う(ステップS24)。具体的には、ある行について、隣接する行とフォント構成画素のパターンを比較し、隣接する行とフォント構成画素のパターンが同じである行についてはコスト値を「+2」する。この処理も、文字としてのバランスの面を考慮して行われる。隣接する行のフォント構成画素のパターンが同一であると、これまでのコスト計算においてはコスト値は同じになる。よって、そのコスト値を有する行が後述の拡大処理により拡大対象となると、隣接する行両方が拡大されることになる。その結果、同一の画素パターンを有する行が両方とも拡大されることになり、1つの文字中の一部分のみが必要以上に拡大されてしまうことになる。そこで、隣接する行が同一のパターンを有する場合は、コスト値を増加させて、それらの行が拡大されににくすることにより、1つの文字中の特定箇所のみが偏って拡大されることを防止する。
【0040】
こうして、コスト計算処理が終了すると、処理は図3に示す行方向拡大処理へ戻る。そして、CPU16は対象となるフォントの全ての行についてコスト計算が完了したか否かを判定し(ステップS13)、完了していない場合は全ての行のコスト計算を行う。全ての行についてコスト計算が完了した場合(ステップS13;Yes)、CPU16は図7(a)に示すように、コストの低い順に行を順序付けする(ステップS14)。図7(a)においては、コストの小さい行から順に、A、B、C、…と順序が付されている。なお、同じコストを有する行が複数ある場合は、文字の中央に近い行から順に上位の順序を付すことにより、拡大する方向が左右方向において偏らないようにする。図7(a)の例では、コストが「3」である列が6つあるが、それらについて中央から順に左右に分散するようにC、D、E、F、G、Hと順序付けをしている。こうして、文字の中央から左右にバランスよく拡大がなされるように、拡大対象となる順序を付けている。
【0041】
コストの低い順に各行の順序付けが終了すると、CPU16は、拡大率に基づいて拡大する行の数を決定する(ステップS15)。ここで、拡大率とは、コスト方式処理により拡大をする場合における、字母データの拡大する割合を指す。ステップS1においてサイズ指定情報を受け取った場合、当該情報により指定されたサイズと字母データのサイズに基づいて拡大率を取得することができる。例えば、ユーザが指定したサイズが9ドットの場合、コスト方式処理を行う字母データは当該指定サイズに最も近い8ドットとなる。よって、その拡大率は、「9/8*100」となり、112.5%となる。
【0042】
また、ユーザの指示に拘わらず、携帯端末装置10の特定の処理によって自動的にサイズの指定がなされる場合でも、必ず拡大率は決定される。よって、その拡大率に基づいて、対象となるフォントの行数のうち、いくつの行を拡大するかを決定する。例えば、説明の便宜上、拡大の対象となるフォントの行数が15行(15ドット)であり、拡大率が120%(1.2倍)と決定されたとする。この場合、拡大する行の数は15×1.2=18(行)となり、3つの行だけ拡大することになる。図7(a)及び(b)の例はこの場合の例である。
【0043】
こうして、拡大する行の数が決定すると、CPU16は、拡大処理を実行する(ステップS16)。即ち、コストが小さい行から順に、拡大する行の数だけ拡大を行う。この場合の拡大は、例えば、拡大の対象となる行と同一のフォント画素パターンの行を拡大の対象となる行の隣に挿入することにより行われる。図7(a)及び(b)の例では、前述のように拡大する行の数は3行であるので、図7(a)に示すコストの小さい行から順に3つの行(コスト順序が「A]、「B」、「C」の行)について、同一のフォント構成画素パターンを有する行を挿入する。その結果、図7(b)に示すように、3つの行が挿入されて、全体として横方向に18行(18ドット)の拡大文字が得られている。
【0044】
こうして、行方向拡大処理が終了すると、処理は図2に示すメインルーチンへ戻る。そして、CPU16は、列方向拡大処理を行う(ステップS4)。なお、この列方向拡大処理において対象となるフォントは、行方向への拡大処理後のフォントとなる。よって、図7(a)及び(b)の例では、横方向が18行(ドット)となったフォントに対して行われる。
【0045】
列方向拡大処理は、基本的に図3に示す行方向拡大処理と同様の処理を、行毎ではなく、列ごとに行う。即ち、拡大対象となるフォントを列ごとに分割し(ステップS11)、各列についてコスト計算を行い(ステップS12)、コストの低い順に各列について順序付けを行い(ステップS14)、拡大率に基づいて拡大対象となる列の数を決定し(ステップS15)、対象となる列に拡大処理を実行する(ステップS16)。なお、図4に示すコスト計算処理においては、縦方向に隣接画素を考慮したコストの重み付け(ステップS22)、スペースを考慮した重み付け(ステップS23)、及び同一コストを有する列の重み付け(ステップS24)を実行する。また、本例の拡大処理では、対象となるフォントを縦方向及び横方向に同一の拡大率で拡大するので、ステップS15で使用する拡大率は行方向拡大処理において使用する拡大率と同一となる。
【0046】
こうして、行方向及び列方向に拡大処理が完了すると、CPU16は得られたフォント、即ち処理フォントを処理フォントメモリ14に記憶し(ステップS5)、必要に応じて表示部12に表示する。こうして、拡大後のフォントが携帯端末装置10の表示部12上に表示される。
【0047】
以上のように、本発明のフォント拡大処理では、対象となるフォントの構成(フォント構成画素のパターン)に基づいて行、列ごとにコストを計算し、コストに基づいて適切な行、列を拡大する。具体的には、線分に近い行、列は拡大されにくくすることにより、文字中の線分部分が必要以上に拡大されることを防止する(ステップS22)。また、端部にスペースが多い文字については、スペース部分のみが拡大されて文字部分の拡大が不十分になることを防止する(ステップS23)。さらに、同一パターンを有する行、列が隣接する場合には、それらが拡大されにくくして、文字中の特定の部分のみが必要以上に拡大されることを防止する(ステップS24)。これらの処理により、文字を構成する画素パターンを考慮して、指定されたサイズが19ドット未満という小さいフォントであっても、バランスが不自然とならないようにし、自然な拡大を可能としている。
【0048】
なお、以上説明したコスト方式処理によるフォントの拡大は、表示部12上に表示すべき文字列が決定された時点で1文字ずつ実行することができる。また、ユーザが表示フォントのサイズ変更などを指定した場合には、フォントROM22内に予め用意されている全ての字母データについて拡大処理を行ってその結果を処理フォントメモリ14内に格納してもよい。いずれの場合でも、上述のようにフォント拡大処理自体は整数の単純な演算で済むので、処理に必要な時間は非常に短く、ユーザが不快に感じるほどの処理時間を要することはない。
【0049】
(ii)コスト方式処理によりフォントを縮小する場合
次に、コスト方式によりフォントを縮小する場合について図8乃至図10を参照して説明する。図8及び図9はコスト方式処理によりフォントを縮小する場合のメインルーチン及びサブルーチンのフローチャートである。また、図10はコスト方式処理によりフォントを縮小する場合の各工程を説明するための図である。
【0050】
フォント縮小処理は、基本的にフォント拡大処理と同様に行われる。即ち、CPU16は、サイズ指定情報を受け取ると(ステップS41)、指定されたサイズに最も近い字母データをフォントROM22から抽出し、作業メモリであるRAM24に展開する(ステップS42)。
【0051】
なお、コスト方式処理により縮小する場合に受け取るサイズ指定情報は、ユーザによる指定の場合も文字表示プログラムが自動的に要求する場合も共に、表示フォントのサイズが19ドット未満の場合であり、且つ、字母データを縮小することにより最も効率的に指定されたサイズのフォントを生成することが可能なサイズに限定される。
【0052】
次に、CPU16は、行方向縮小処理を行い(ステップS43)、さらに列方向縮小処理を行う(ステップS44)。そして、処理フォントが作成されると、CPU16は、作成された処理フォントを処理フォントメモリ14に記憶する(ステップS45)とともに、表示部12に表示フォントとして表示する(ステップS46)。こうして、コスト方式処理によるフォントの縮小がなされる。
【0053】
次に、コスト方式処理によるフォントの縮小における行方向縮小処理について図9を参照して説明する。図9は、行方向縮小処理のフローチャートである。図9に示す行方向縮小処理は、基本的に図3に示すコスト方式処理によりフォントを拡大する場合における行方向拡大処理と同様の手順で行われる。即ち、CPU16は、対象となるフォントを行単位に分割し(ステップS51)、行ごとにコストを算出し(ステップS52)、全ての行についてコストが得られると(ステップS53;Yes)、コストの低い順に行を順序付けする(ステップS54)。次に、CPU16は、縮小率に基づいて縮小する行の数を決定し(ステップS55)、対象となる行について縮小処理を行う。
【0054】
このように、フォント縮小処理における行方向縮小処理は、基本的な流れはフォント拡大処理における行方向拡大処理と同様である。但し、フォント縮小処理における行方向縮小処理は、ステップS52におけるコスト計算方法及びステップS56における縮小方法において、フォント拡大処理の場合と異なる。以下、これについて説明する。
【0055】
まず、コスト計算について説明する。フォント拡大処理におけるコストは、線分量、即ち各行又は列に含まれる画素が線分に近いか、ドットに近いかを示す値であった。これに対し、フォント縮小処理におけるコストは、類似度、即ち各行又は列が、隣接する行又は列にどの程度類似しているかを示す値である。具体的には、CPU16は各行に対し、隣の行との排他的論理和(XOR)を算出する。排他的論理和の値は、隣接する画素が同じであると「0」となり、隣接する画素が異なると「1」となる。よって、各行に含まれる各フォント構成画素について排他的論理和を求め、その値が「1」となるフォント構成要素の数をその行のコストとする。よって、コストが高いほど、その行と隣接する行とのフォント画素パターンは非類似であり、コストが低いほど、その行と隣接する行とのフォント画素パターンは類似であることになる。こうして、コストは隣接する行との類似度(厳密には、非類似度)を示す値となる。
【0056】
即ち、ある行のコストが低いということは、その行のフォント画素パターンが隣接する行のフォント画素パターンと類似していることを意味する。よって、類似している画素パターンを有する行を優先的に縮小の対象とすることにより、類似している行を削除する。これは、隣接する行が相互に類似している場合には、それを優先的に削除しても、文字全体に与える影響、違和感は少ないであろうとの発想に基づいている。これにより、自然な縮小が可能となる。
【0057】
行方向縮小処理が終わると、次に列方向縮小処理が行われるが(ステップS44)、これは行方向縮小処理と基本的に同様である。対象となるフォントを列単位に分割し(ステップS51)、列ごとにコストを算出し(ステップS52)、全ての列についてコストが得られると(ステップS53;Yes)、コストの低い順に列を順序付けする(ステップS54)。そして、CPU16は、縮小率に基づいて縮小する列の数を決定し(ステップS55)、対象となる列について縮小処理を行う。
【0058】
図10(a)〜(c)に列方向縮小処理の様子を示す。まず、図10(a)に示すように各列についてコスト計算が行われ、次に図10(b)に示すようにコストの低い順に列の順序付けが行われ、コストが低い列から順に縮小の対象となる。ステップS56の縮小処理においては、例えば図10(c)に示すように、コストの低い列から順にその行が削除される。図10(c)の例では、コストの低い3つの列(A、B、C)が削除されている。
【0059】
以上説明したように、コスト方式処理によるフォントの縮小では、対象となるフォントを行方向及び列方向に分割し、それぞれ隣接する行又は列との類似度を考慮して縮小を行う。よって、表示フォントのサイズが19ドット未満であっても、フォント画素パターンが類似する行又は列が隣接している部分を優先して縮小(行又は列の削除)を行うので、縮小後のフォントが不自然となることが少なくなる。
【0060】
図11(a)及び(b)に、後述するアドレス方式処理により得られた拡大・縮小フォントと、コスト方式処理により得られた拡大・縮小フォントの例を示す。図からわかるように、サイズが19ドット未満のフォントを表示する場合、アドレス方式処理による拡大・縮小フォントでは縦や横のストロークが拡大により2重になったり(「本」という文字の横線、「肌」という文字の右側の縦線など)、斜めの線がギザギザに見えたりしている。また、縮小により、文字の左右のバランスが崩れたり(「本」という文字の左右のバランス)、画素同士が連結して別の文字に見えたり(「肌」という文字の左側が「月」ではなく「目」に見える)している。これに対し、コスト方式処理によるフォント拡大・縮小処理では、そのような不具合は生じず、自然な拡大・縮小フォントが得られている。
【0061】
[アドレス方式処理]
次に、ユーザが指定したサイズが19ドット以上の場合に行われるアドレス方式処理によるフォントの拡大・縮小について説明する。アドレス方式処理は、前述のようにCPU16がプログラムROM20内に格納されているアドレス方式処理プログラムを実行することにより行われる。以下、アドレス方式処理によりフォントを拡大する場合、及び、アドレス方式処理によりフォントを縮小する場合について、順に説明する。
【0062】
(i)アドレス方式処理によりフォントを拡大する場合
まず、アドレス方式処理によりフォントを拡大する場合について図12乃至17を参照して説明する。図12及び図13は、アドレス方式処理によりフォントを拡大する場合のメインルーチン及びサブルーチンのフローチャートである。また、図14乃至図17はアドレス方式処理によりフォントを拡大する場合の各工程を説明するための図である。
【0063】
図12を参照すると、まずCPU16はサイズ指定情報を受け取る(ステップS61)。サイズ指定情報は、例えば、ユーザが入力部18を操作して表示フォントのサイズの指定、選択や表示モードの指定、選択を行った場合に、入力部18からの指示に基づいて生成される。また、ユーザによる指示以外の場合でも、表示部12上への表示内容に応じてサイズが指定される場合もある。
【0064】
なお、アドレス方式処理による拡大を行う場合に受け取るサイズ指定情報は、ユーザによる指定の場合も文字表示プログラムが自動的に要求する場合も共に、表示フォントのサイズが19ドット以上であり、且つ、字母データを拡大することにより最も効率良く生成することが可能なサイズに限定される。
【0065】
サイズ指定情報を受け取ると、CPU16は指定されたサイズに最も近い字母データをフォントROM22から読み出し、作業メモリであるRAM24へ展開する(ステップS62)。具体的に、サイズ指定情報として受け取ったサイズが29ドットの場合、28ドットの字母データを読み出す。一方、拡大指示として受け取ったサイズが34ドットの場合、32ドットの字母データを読み出す。
【0066】
そして、CPU16は、拡大処理を実行し、字母データを展開した拡大の対象となるフォントを拡大する(ステップS63)。なお、本例の場合、横方向と縦方向の拡大率は同一に設定される。こうして、対象となるフォントの拡大が完了すると、CPU16は、拡大後のフォントデータを処理フォントとして処理フォントメモリ14に一時的に保存し(ステップS64)、さらに表示部12上に表示フォントとして表示する(ステップS65)。
【0067】
次に、ステップS63で行われる拡大処理の詳細について説明する。図13は、アドレス方式処理における拡大処理を表すフローチャートである。なお、アドレス方式処理は、サイズを19ドット以上に拡大する場合にのみ行われる処理であるが、以下の説明では、便宜上、サイズが8ドットの字母データをサイズ指定情報に基づいて9ドットに拡大するものとする。
【0068】
図13によれば、CPU16は、まず、ステップS62においてRAM24へ展開した字母データの横方向の位置を示すx座標として「1」をセットする。さらに、当該字母データの縦方向の位置を示すy座標として「1」をセットする。これにより、CPU16は、図14に示すように、拡大後のフォントデータである処理フォントを展開する際の始点となる基準座標(x,y)として座標30(1,1)を設定する(ステップS71)。ここで、図14は、サイズが8ドットである字母データのデータ構造を模式的に示す図である。また、基準座標30(1,1)は、字母データを構成する構成画素の中の1つである画素34を特定している。なお、サイズが8ドットの字母データの場合、構成画素は「8*8」となり64個である。
【0069】
次に、CPU16は、図15(a)に示す計算式「(x,y)*B/A=(x1,y1)」に基づいて、対応座標(x1,y1)を算出する(ステップS72)。ここで、変数Aは、字母データのサイズである。一方、変数Bは、ステップS61においてサイズ情報として受け取ったサイズである。即ち、この実施例では、変数Aが「8」、変数Bが「9」となる。具体的に、図15(a)に示す計算式に、変数Aとして「8」、変数Bとして「9」を対応させた結果を、対応座標算出結果として図15(b)に示す。図15(b)によれば、基準座標(x,y)が座標30(1,1)である場合、対応座標(x1,y1)は(1.125,1.125)となる。
【0070】
次に、CPU16は、算出した対応座標(x1,y1)に基づいて対応画素を決定する(ステップS73)。図16に、サイズが9ドットのフォントデータのデータ構造を模式的に示す。図16(a)において、算出した対応座標(1.125、1.125)に該当する座標は、座標35である。そして、CPU16は、対応座標35(1.125,1.125)に基づいて、対応画素が画素43であることを決定する。これは、対応座標35(1.125,1.125)に基づいて、図14に示す基準座標30が特定する画素34に対応する所定の範囲36を想定した場合、当該範囲36が画素43に最も広く重複しているからである。
【0071】
次に、CPU16は、基準座標(x,y)が特定する画素のパターンを拡大後のフォントデータである処理フォントとして展開する(ステップS74)。即ち、基準座標(x,y)が特定する画素のパターンを、決定した対応画素の領域に書き込む。具体的に、CPU16は、図14に示す基準座標30(1,1)が特定する画素34の値を、図16(b)に示すように決定した対応画素43の領域に書き込む。
【0072】
そして、CPU16は、基準座標を構成するx座標と変数Aの値を比較する(ステップS75)。具体的には、x座標の値が「8」より小さいか否かをチェックする。x座標の値が変数Aの値より小さい場合(ステップS75;Yes)、CPU16は、x座標の値に「1」を加算し(ステップS76)、ステップS72にリターンする。具体的には、ステップS75の時点で基準座標が(1,1)の場合、基準座標を(2,1)とし、ステップS72乃至S75を繰り返す。
【0073】
一方、x座標の値が変数Aの値と等しい、又は、x座標の値が変数Aの値より大きい場合(ステップS75;No)、CPU16は、基準座標を構成するy座標と変数Aの値を比較する(ステップS77)。具体的には、y座標の値が「8」より小さいか否かをチェックする。y座標の値が変数Aの値より小さい場合(ステップS77;Yes)、CPU16は、y座標の値に「1」を加算し、x座標の値を「1」に初期化し(ステップS78)、ステップS72にリターンする。具体的に、ステップS77の時点で基準座標が(8,1)の場合、y座標の値に「1」を加算し、x座標の値を「1」に初期化することで、基準座標(1,2)を設定する。そして、CPU16は、ステップS72乃至S77の処理を繰り返す。
【0074】
一方、y座標の値が変数Aの値と等しい、又は、y座標の値が変数Aの値より大きい場合(ステップS77;No)、CPU16は、拡大処理を完了する。具体的には、ステップS77の時点で基準座標が(8,8)の場合、字母データを構成する全ての構成画素のパターンを拡大後のフォントデータである処理フォントとして展開したこととなるため、CPU16は、拡大処理を完了する。
【0075】
こうして、拡大処理が完了すると、図12に示すように、CPU16は拡大処理により得られた、図17に示すような処理フォントを処理フォントメモリ14に記憶し(ステップS64)、必要に応じて表示部12に表示する(ステップS65)。
【0076】
なお、拡大処理のステップS73において、決定する対応画素が複数となる場合がある。具体的には、基準座標(x,y)が図14に示すような座標31(1,4)である場合、図15(b)に示す対応座標算出結果によれば、対応座標(x1,y1)は(1.125,4.5)となる。この場合、図16(a)において、対応座標(1.125,4.5)に該当する座標は、座標37である。そのため、対応座標37に基づいて、基準座標31が特定する画素36に対応する所定の範囲38を想定した場合、当該範囲38は、画素44及び画素45に同じ面積分重複している。よって、CPU16は、ステップS73において画素44及び画素45を対応画素として決定する。このように、アドレス方式処理によりフォントを拡大する場合、1つの特定画素に対して対応画素が複数となることがある。これにより、サイズが大きくなり、構成要素が増加した場合であっても、文字バランスの整った自然な拡大を行うことができる。
【0077】
(ii)アドレス方式処理によりフォントを縮小する場合
次に、アドレス方式処理によりフォントを縮小する場合について説明する。アドレス方式によりフォントを縮小する処理は、基本的に拡大する処理と同様に行われる。即ち、CPU16は、サイズ指定情報を受け取ると(ステップS61)、CPU16は指定されたサイズに最も近いの字母データをフォントROM22から読み出し、作業メモリであるRAM24へ展開する(ステップS62)。
【0078】
そして、CPU16は、縮小処理を実行し、字母データを展開した縮小の対象となるフォントを縮小する(ステップS63)。なお、本例の場合、横方向と縦方向の拡大率は同一に設定される。こうして、対象となるフォントの縮小が完了すると、CPU16は、縮小後のフォントデータを処理フォントとして処理フォントメモリ14に一時的に保存し(ステップS64)、さらに表示部12上に表示フォントとして表示する(ステップS65)。
【0079】
なお、縮小処理のステップS73において、決定した対応画素の領域に既に所定の値が書き込まれている場合がある。この場合、当該対応画素に値を上書きすることは出来ないため、CPU1は、ステップS74を行わず、ステップS75にスキップする。これにより、サイズが小さくなり、構成画素が減った場合であっても、文字バランスの整った自然な縮小を行うことができる。
【0080】
[フォント変形処理]
次に、フォント変形処理について図18を参照して説明する。図18は、フォント変形処理のフローチャートである。
【0081】
図18を参照すると、まず、CPU16はサイズ指定情報を受け取る(ステップS81)。サイズ指定情報は、例えばユーザが入力部18を操作して表示フォントのサイズの指定、選択や表示モードの指定、選択を行った場合に、入力部18からの指示に基づいて生成される。また、ユーザによる指示以外の場合でも、表示部12上への表示内容に応じてサイズの指定が必要となる場合もある。
【0082】
次に、CPU16は、サイズ指定情報として受け取ったサイズが19ドット以上であるか否かを判定する(ステップS82)。当該サイズが19ドット未満である場合(ステップS82;No)、CPU16はコスト方式処理を行う(ステップS83)。一方、当該サイズが19ドット以上である場合(ステップS82;Yes)、CPU16はアドレス方式処理を行う(ステップS84)。コスト方式処理、又は、アドレス方式処理が完了すると、CPU16は、フォント変形処理を完了する。
【0083】
なお、上記の実施形態では、ステップS82において指定されたサイズが19ドット以上であるか否かを判定しており、当該サイズが19ドット未満であればコスト方式処理を行い、当該サイズが19ドット以上であればアドレス方式処理を行う。しかし、本発明において、判定基準となるサイズは19ドットに限定されるものではなく、フォントの拡大・縮小といった変形を自然に行うことが可能であれば、判定基準となる指定サイズは任意に設定することが可能である。
【0084】
また、上記の実施形態では、6種類のサイズを字母データとしているが、本発明は、これに限定されるものではなく、例えば明朝体やゴシック体等といった様々なデザインのフォントを字母データとしてフォントROM22に記憶させておくことも可能である。即ち、字母データは、デザイン、サイズ共に任意に設定することができる。通常、携帯端末装置において、サイズが16ドット以上では明朝体とゴシック体を表現することができるようになり、サイズが24ドット以上では漢字の全てのストロークを表現することができるようになるからである。
【0085】
また、上記の実施形態では、フォントの縦横比が等しい正方フォントを使用してフォント変形処理を行っているが、本発明はこれに限定されるものではなく、縦横比を任意に設定することを可能としてもよい。例えば、縦の拡大比率が大きいと、縦長のフォントを生成でき、横の拡大比率が大きいと横長のフォントを生成することができる。よって、字母データとして正方フォントを予め記憶しておくだけで、任意の縦長、横長のフォントを生成することができる。
【0086】
このように、本発明によれば、ユーザ等により指定されたフォントのサイズが、判定基準となる所定のサイズ以上であるか否かを判定し、当該判定の結果に基づいてコスト方式処理、又は、アドレス方式処理を行っている。即ち、判定基準となる所定のサイズ以上であれば、アドレス方式処理により字母データの拡大・縮小を行うことで、バランスの整ったフォントを生成することができる。一方、判定基準となる所定のサイズ未満であれば、コスト方式処理により字母データの拡大・縮小を行うことで、不自然な太さの線が出現したりすることのないフォントを生成することができる。このように、生成するフォントのサイズに応じた適切な処理により字母データの拡大・縮小を行うことで、バランスの整った自然なフォントを携帯端末装置上で表示することができる。
【0087】
また、フォントROM22に記憶された数種類の字母データを拡大・縮小することにより、任意の大きさのフォントを生成することができる。よって、ユーザが指定する可能性のある全てのサイズのフォントを予めフォントROM22に記憶しておく場合と比較して、メモリの使用容量を大幅に節約することができる。
【図面の簡単な説明】
【図1】拡大・縮小処理を適用した携帯端末装置の概略構成を示す。
【図2】コスト方式処理により拡大する場合のフローチャートである。
【図3】コスト方式処理における行(列)方向拡大処理のフローチャートである。
【図4】コスト方式処理におけるコスト計算処理のフローチャートである。
【図5】字母データを拡大する場合におけるコスト計算処理例を示す図である。
【図6】コスト計算処理の例を示す図である。
【図7】行(列)方向拡大処理の例を示す図である。
【図8】コスト方式処理により縮小する場合のフローチャートである。
【図9】行(列)方向縮小処理のフローチャートである。
【図10】字母データを縮小する場合におけるコスト計算処理例を示す図である。
【図11】コスト方式処理とアドレス方式処理の処理結果を比較する図である。
【図12】アドレス方式処理のフローチャートである。
【図13】アドレス方式処理における拡大(縮小)処理のフローチャートである。
【図14】サイズが8ドットの字母データのデータ構造を模式的に示す図である。
【図15】対応座標を算出するための計算式、及び、対応座標算出結果を示す。
【図16】サイズが9ドットの字母データのデータ構造を模式的に示す図である。
【図17】拡大後の処理フォントのデータ構造を模式的に示す図である。
【図18】フォント変形処理のフローチャートである。
【符号の説明】
10 携帯端末装置、12 表示部、14 処理フォントメモリ、16 CPU、18 入力部、20 プログラムROM、22 フォントROM、24 RAM、
[0001]
TECHNICAL FIELD OF THE INVENTION
The present invention relates to enlargement and reduction processing of a bitmap font.
[0002]
[Background Art]
In a device such as a mobile phone and a PDA (Personal Digital Assistant), a bitmap font is used for displaying characters and the like. The bitmap font displays fonts such as characters and symbols in accordance with a pixel arrangement pattern prepared in advance. Unlike an outline font that displays characters, symbols, and the like as a set of vector data, a bitmap font is a simple pixel array pattern and therefore has a small amount of data per character. For this reason, a bitmap font is used in a mobile phone, a PDA, or the like having a smaller memory capacity and a lower processing capacity than a PC (Personal Computer).
[0003]
2. Description of the Related Art In recent years, the number of pixels in a display area used for mobile phones and PDAs has been steadily increasing, and it has become increasingly necessary to provide users with various fonts and fonts using bitmap fonts. ing. As a countermeasure for such a request, it has been proposed to provide a user with various fonts and sizes by expanding or reducing the size based on the original data which is a bitmap font stored in advance. (For example, see Patent Documents 1 and 2).
[0004]
[Patent Document 1]
JP-A-8-63147
[Patent Document 2]
JP-A-7-156450
[0005]
[Problems to be solved by the invention]
However, a relatively small font displayed on a mobile phone, a PDA, or the like often has a thickness of one pixel. Therefore, when displaying a small font smaller than a predetermined size, when the original data is enlarged by a method of performing coordinate conversion based on an address which is an aspect ratio between the size of the original data of the bitmap font and the size after enlargement, The enlarged font may have unnatural thickness. Also, if a similar small font is reduced by the coordinate conversion based on the address as described above, an unnatural thickness line may be formed after the reduction, or the line segments constituting the font may be connected inappropriately. Font may be crushed.
[0006]
On the other hand, when displaying a large font of a predetermined size or more, a well-balanced character can be easily generated by enlarging or reducing the original data of the bitmap font by a method of performing coordinate conversion based on an address. .
[0007]
SUMMARY OF THE INVENTION The present invention has been made in view of the above points, and when a bitmap font used in a mobile phone or a PDA is enlarged or reduced, the size of the font to be displayed is taken into consideration, so that various sizes can be obtained with a small capacity. The purpose is to generate natural fonts with natural fonts and sizes.
[0008]
[Means for Solving the Problems]
According to one aspect of the present invention, character data storage means for storing font data of a bitmap font as character data, size specification information obtaining means for obtaining size specification information including a specified font size, Size comparison means for comparing the size included in the information with a reference size, and character data acquisition means for acquiring the character data stored in the character data storage means based on the size included in the size designation information, An enlarging / reducing means for enlarging or reducing the character data acquired by the character data acquiring means based on the comparison result of the size comparing means and the size.
[0009]
Further, a font processing method from a similar viewpoint includes a character data storage step of storing font data of a bitmap font as character data, a size specification information obtaining step of obtaining size specification information including the size of the specified font, A size comparison step of comparing the size included in the size designation information with a reference size; and a script data acquisition for acquiring the script data stored in the script data storage unit based on the size included in the size designation information. And an enlarging / reducing step of enlarging or reducing the character base data acquired by the character base data acquisition part based on the comparison result of the size comparison part and the size.
[0010]
The above font processing apparatus or method first stores the font data of the bitmap font as character data. Then, the font processing device or method acquires the size designation information. Here, the size designation information includes information on a size arbitrarily designated by a user using the font processing device and a size automatically designated by the font processing device. Next, the font processing apparatus or method compares the size included in the size designation information with an arbitrarily set reference size. In addition, the font processing apparatus or method acquires character base data based on the size included in the size designation information. Further, the font processing apparatus or method enlarges or reduces the character data acquired based on the comparison result and the size.
[0011]
According to this, enlargement or reduction of the character data can be performed by appropriate processing according to the designated size. Therefore, a balanced natural font can be generated. In addition, a font of an arbitrary size can be generated by enlarging or reducing the character base data. Therefore, it is not necessary to previously store fonts of all sizes that may be specified, and it is possible to greatly reduce the memory usage.
[0012]
In another aspect of the above-described font processing apparatus, the enlargement / reduction unit may include, when the comparison result of the size comparison unit indicates that the size included in the size designation information is smaller than the reference size, A cost method enlarging / reducing means for enlarging or reducing the character base data based on a cost showing a feature of the configuration, and a comparison result of the size comparing means, wherein the size included in the size designation information is larger than the reference size. And an address type enlarging / reducing means for enlarging or reducing the character data by converting coordinates based on an address which is an aspect ratio of the character data.
[0013]
When the size included in the size designation information is smaller than the arbitrarily set reference size, the font processing apparatus enlarges or reduces the character data by the cost method enlarging / reducing means. Here, the cost method enlarging / reducing means will be specifically described. First, the font processing apparatus analyzes the acquired character data in the vertical direction, and calculates a numerical value of the pixel configuration in the vertical direction of the pixels forming the character data. Then, the character base data is expanded or reduced in the horizontal direction based on the cost as the analysis result. Similarly, the font processing apparatus analyzes the character base data in the horizontal direction, and calculates the cost of digitizing the horizontal pixel configuration of the pixels forming the character base data. Then, the character base data is enlarged or reduced in the vertical direction based on the cost as the analysis result.
[0014]
On the other hand, if the size included in the size designation information is larger than the arbitrarily set reference size, the address method enlarging / reducing means enlarges or reduces the character data. Here, the address method enlarging / reducing means will be specifically described. First, the font processing device calculates an aspect ratio between the size of the obtained character data and the size included in the size designation information as an address based on predetermined coordinates. Then, the font processing apparatus performs enlargement or reduction by performing coordinate conversion of the character base data based on the calculated address.
[0015]
According to this, a font having a relatively small size can be generated without an unnatural thickness line by expanding or reducing the character base data by the cost method processing. On the other hand, for a font having a relatively large size, a natural font with a well-balanced balance can be easily generated by enlarging or reducing the character data by the address method processing.
[0016]
In still another aspect of the font processing apparatus, the character data storage means stores font data of a plurality of sizes and / or a plurality of designs as the character data, and the reference size is determined by determining the design. Is a possible size.
[0017]
According to this, when the specified size is smaller than the size at which the design can be discriminated, the font processing device may cause the font to be crushed or unnatural rather than accurately representing the font design by the cost method processing. It is possible to generate a font that emphasizes the appearance of no thick line. On the other hand, if the specified size is larger than the size that allows the design to be determined, the font processing device can accurately represent the design and generate a natural font by the address processing. Therefore, it is possible to generate a well-balanced font with the specified size and design.
[0018]
According to another aspect of the present invention, the font processing apparatus includes the above-described font processing apparatus, storage means for storing font data generated by the font processing apparatus, and a display unit for displaying font data generated by the font processing apparatus. A terminal device can be configured. The terminal device can be, for example, a portable terminal device such as a mobile phone or a PDA. With the font processing apparatus of the present invention, character data can be enlarged or reduced in consideration of the specified font size, so that even such a portable terminal device can generate and display a balanced natural font. Can be.
[0019]
According to still another aspect of the present invention, there is provided a font processing program executed on a terminal device including a computer, the computer comprising: a character data storage unit for storing font data of a bitmap font as character data; Size designation information acquisition means for acquiring size designation information including the size of the size, size comparison means for comparing the size contained in the size designation information with a reference size, and the character model based on the size contained in the size designation information. A character data acquisition means for acquiring the character data stored in the data storage means, and an enlargement / reduction means for enlarging or reducing the character data acquired by the character data acquisition means based on the comparison result of the size comparison means. Let it work.
[0020]
The above-described font processing apparatus can be realized by executing the above-described font processing program on a computer in a terminal device.
[0021]
BEST MODE FOR CARRYING OUT THE INVENTION
Hereinafter, preferred embodiments of the present invention will be described with reference to the drawings.
[0022]
[Configuration of mobile terminal device]
FIG. 1 shows a schematic configuration of a portable terminal device to which a bitmap font enlargement / reduction process according to an embodiment of the present invention is applied. In FIG. 1, a mobile terminal device 10 is a terminal device having a relatively small image display area, such as a mobile phone or a PDA. The mobile terminal device 10 includes a display unit 12, a processing font memory 14, a CPU 16, an input unit 18, a program ROM 20, a font ROM 22, and a RAM 24.
[0023]
The display unit 12 can be a light and thin display device such as an LCD (Liquid Crystal Display), and displays a font such as a character or a symbol formed of a bitmap font in a display area.
[0024]
The input unit 18 can be constituted by various operation buttons or the like for a mobile phone, or a tablet or the like for detecting contact with a touch pen or the like for a PDA, and is used when a user performs various instructions, designation, selection, and the like. used. Specifically, it is used when the user specifies the size of the display font to be displayed in the display area of the display unit 12. Instructions and designations input to the input unit 18 are converted into electrical signals and sent to the CPU 16. As a method of specifying the size of the display font, various methods such as a method of directly inputting a numerical value of a dot and a method of specifying from a plurality of options can be applied.
[0025]
The program ROM 20 stores various programs for executing various functions of the mobile terminal device 10, and particularly in the present embodiment, a bitmap font enlargement / reduction program (hereinafter, referred to as “font enlargement / reduction program”), A font display program using a bitmap font is stored. The font enlargement / reduction program has two types, a cost method processing program and an address method processing program. Although details will be described later, when the size specified by the user is less than 19 dots, the font is enlarged / reduced by the cost method processing based on the cost method processing program. On the other hand, when the size specified by the user is 19 dots or more, the font is enlarged or reduced by the address method processing based on the address method processing program.
[0026]
The font ROM 22 stores the original data (also referred to as “character data”) of the bitmap font. In the present embodiment, it is assumed that character base data having sizes of 12, 16, 20, 24, 28, and 32 dots are stored in advance. Here, the character base data is generally a font having an equal aspect ratio, such as 12 × 12 dots (also called “square font”).
[0027]
The RAM 24 is used as a working memory when enlarging / reducing character data in accordance with a bitmap font enlarging / reducing program. On the other hand, the processing font memory 14 is a memory for temporarily storing fonts (hereinafter, also referred to as “processing fonts”) created by enlargement or reduction processing by a bitmap font enlargement / reduction program. The processing font is displayed as a display font by the CPU 16 described later. The processing font memory 14 can be generally configured by a RAM, a flash memory, or the like, and retains stored contents until the power of the portable terminal device 10 is turned off.
[0028]
The CPU 16 executes various functions of the mobile terminal device 10 by executing various programs stored in the program ROM 20. In particular, in the present embodiment, a predetermined display font is displayed on the display unit 12 by reading and executing a character display program stored in the program ROM 20. Also, by reading and executing the font enlargement / reduction program also stored in the program ROM 20, the character data stored in the font ROM 22 is enlarged or reduced to generate a processing font. Note that the CPU 16 realizes various functions of the mobile terminal device 10 by executing various programs other than the above, but since these have no direct relation to the present invention, description thereof will be omitted.
[0029]
[Cost method processing]
Next, the enlargement / reduction of the font by the cost method processing performed when the size specified by the user is less than 19 dots will be described. The cost method processing is performed by the CPU 16 executing the cost method processing program stored in the program ROM 20 as described above. Hereinafter, a case where the font is enlarged by the cost method processing and a case where the font is reduced by the cost method processing will be sequentially described.
[0030]
(I) When expanding fonts by cost method processing
First, a case of enlarging a font by the cost method processing will be described with reference to FIGS. 2 to 4 are flowcharts of a main routine and a subroutine for enlarging a font by the cost method processing. FIGS. 5 to 7 are diagrams for explaining each step in the case of enlarging a font by the cost method processing.
[0031]
Referring to FIG. 2, first, the CPU 16 receives size designation information (step S1). The size specification information is generated based on an instruction from the input unit 18 when, for example, the user operates the input unit 18 to specify, select, or specify or select a display font size and a display mode. Further, even in cases other than the user's instruction, the size may be specified in accordance with the display content on the display unit 12. For example, when displaying specific character data in the display area, the character display program may automatically request the font size.
[0032]
The size designation information received when performing enlargement by the cost method processing is information of a size that is less than 19 dots and that can be most efficiently generated by enlarging the character base data. Specifically, when the designated size is 13 dots, the font of 13 dots can be generated most efficiently by enlarging the character data of 12 dots. Therefore, in such a case, 13 dots are received as the size designation information, and the CPU 16 performs enlargement by the cost method processing. However, when the designated size is 15 dots, reducing the 16-dot character data can generate a 15-dot font more efficiently than expanding the 12-dot character data. Therefore, in such a case, the CPU 16 performs reduction by the cost method processing described later.
[0033]
Upon receiving the size designation information, the CPU 16 reads the character data closest to the designated size from the font ROM 22 and expands it on the RAM 24, which is a working memory (step S2). Specifically, when the designated size is 13 dots, character data of 12 dots is read. On the other hand, when the designated size is 17 dots, character data of 16 dots is read.
[0034]
Next, the CPU 16 executes a line-direction enlargement process to enlarge the font to be enlarged by expanding the character data in the line direction (step S3), and then executes a column-direction enlargement process to execute the line-direction enlargement process. The font enlarged in the column direction is further enlarged in the column direction (step S4). In the case of this example, the enlargement ratio in the row direction and the enlargement ratio in the column direction are set to be the same. When the enlargement of the font in the row direction and the column direction is completed in this way, the CPU 16 temporarily stores the enlarged font data in the processing font memory 14 as a processing font (step S5), and further displays the font data on the display unit 12 as a display font. It is displayed (step S6). In this way, the target font is enlarged based on the specific character data, and the processing font of the designated size is displayed on the display unit 12 as a display font.
[0035]
Next, the details of the row direction enlarging process performed in step S3 will be described with reference to the flowchart in FIG. In FIG. 3, first, the CPU 16 divides a target font into a plurality of lines (step S11). Then, the CPU 16 calculates a cost for each row obtained by the division (step S12). Here, the cost is a value obtained based on the number of pixels constituting the font, the presence or absence of adjacent pixels, and the like, and indicates a line segment amount in the font enlargement processing. In other words, the higher the cost, the higher the degree of the line including a line segment instead of a point or a set of points.
[0036]
FIG. 4 shows details of the cost calculation process in step S12. In the cost calculation process, first, as shown in FIG. 5A, the number of font constituent pixels is counted for each line (step S21). In FIG. 5A, the numbers (0, 4, 3, 3,... From the left) shown below each row indicate the cost of each row.
[0037]
Next, as shown in FIG. 5B, addition for pixels having adjacent font constituent pixels is performed (step S22). In the example of FIG. 5B, “2” is added to the cost for each font constituent pixel having adjacent font constituent pixels. Thus, the cost of each row obtained as a result of adding the costs for the adjacent pixels is shown below each row. By adding the costs for the pixels having adjacent pixels, it is possible to distinguish to some extent whether the font constituent pixels existing in the row are dots or close to line segments. In other words, even if the number of font constituent pixels included in one row is the same, the higher the cost of a row, the closer the font constituent pixels included in that row are to a line segment. As will be described later, a row having a higher cost value, that is, a row closer to a line segment, is less likely to be enlarged.
[0038]
Next, as shown in FIG. 6A, a weighting process is performed in consideration of a space (step S23). Specifically, for each row, if the pixels at both ends are spaces (there are no font constituent pixels; they are indicated by spaces in FIGS. 5 and 6), the cost value is set to “+2”. In addition, if the pixel inside one pixel of the pixels at both ends is a space, the cost value is set to “+1”. This process takes into account the balance as a character and the balance when the characters are arranged side by side in a sentence. For example, if the character "shi" in Hiragana is enlarged normally, only the left and right vacant portions are enlarged, and the central font constituent pixels constituting the character are not enlarged much. As a result, when viewed as a sentence after enlargement, other characters are enlarged, but only the character "shi" appears to be small because the font component is not sufficiently enlarged. In order to prevent such a problem, weighting is performed in consideration of space. As a result of this processing, a row having spaces at the upper and lower ends has a large cost value and is hardly enlarged.
[0039]
Next, weighting processing is performed on rows having the same cost value (step S24). Specifically, for a certain row, the pattern of the font constituent pixels is compared with that of the adjacent row, and the cost value is set to “+2” for the row having the same pattern of the font constituent pixels as the adjacent row. This process is also performed in consideration of the balance of characters. If the patterns of the font constituent pixels in the adjacent rows are the same, the cost values will be the same in the cost calculation so far. Therefore, when a row having that cost value is to be enlarged by the enlargement processing described later, both adjacent rows are enlarged. As a result, both rows having the same pixel pattern are enlarged, and only a part of one character is enlarged more than necessary. Therefore, when the adjacent lines have the same pattern, the cost value is increased and the lines are hardly enlarged, so that only a specific portion in one character is unevenly enlarged. To prevent.
[0040]
Thus, when the cost calculation processing is completed, the processing returns to the row-direction enlargement processing shown in FIG. Then, the CPU 16 determines whether or not the cost calculation has been completed for all the lines of the target font (step S13), and if not completed, performs the cost calculation for all the lines. When the cost calculation is completed for all the rows (step S13; Yes), the CPU 16 orders the rows in ascending order of cost as shown in FIG. 7A (step S14). In FIG. 7A, A, B, C,... Are assigned in order from the row having the smallest cost. When there are a plurality of lines having the same cost, a higher order is assigned in order from the line near the center of the character so that the enlargement direction is not biased in the left-right direction. In the example of FIG. 7A, there are six columns whose cost is “3”, and the columns are ordered C, D, E, F, G, and H so that they are distributed left and right in order from the center. I have. In this way, the order of enlargement is set so that enlargement is performed in a balanced manner from the center of the character to the left and right.
[0041]
When the ordering of the rows is completed in the order of the lowest cost, the CPU 16 determines the number of rows to be enlarged based on the enlargement ratio (step S15). Here, the enlargement ratio indicates the enlargement ratio of the character data when the enlargement is performed by the cost method processing. When the size specification information is received in step S1, the enlargement ratio can be obtained based on the size specified by the information and the size of the character data. For example, when the size specified by the user is 9 dots, the character data to be subjected to the cost method processing is 8 dots closest to the specified size. Therefore, the enlargement ratio is “9/8 * 100”, which is 112.5%.
[0042]
Further, regardless of the user's instruction, even when the size is automatically specified by a specific process of the mobile terminal device 10, the enlargement ratio is always determined. Therefore, based on the enlargement ratio, the number of lines to be enlarged among the lines of the target font is determined. For example, it is assumed that the number of font lines to be enlarged is 15 lines (15 dots) and the enlargement ratio is determined to be 120% (1.2 times) for convenience of explanation. In this case, the number of rows to be enlarged is 15 × 1.2 = 18 (rows), and three rows are enlarged. 7A and 7B are examples in this case.
[0043]
When the number of rows to be enlarged is determined in this way, the CPU 16 executes an enlargement process (step S16). That is, enlargement is performed by the number of rows to be enlarged in order from the row having the smallest cost. The enlargement in this case is performed, for example, by inserting a line having the same font pixel pattern as the line to be enlarged next to the line to be enlarged. In the examples of FIGS. 7A and 7B, the number of rows to be enlarged is three as described above, and therefore, three rows (the order of costs is “ A], “B”, and “C” rows), rows having the same font configuration pixel pattern are inserted. As a result, as shown in FIG. 7B, three lines are inserted to obtain an enlarged character of 18 lines (18 dots) in the horizontal direction as a whole.
[0044]
When the row-direction enlargement process is completed, the process returns to the main routine shown in FIG. Then, the CPU 16 performs a column-direction enlargement process (step S4). It should be noted that the target font in the column-direction enlargement processing is the font after the row-direction enlargement processing. Therefore, in the example of FIGS. 7A and 7B, the processing is performed for a font having 18 lines (dots) in the horizontal direction.
[0045]
The column-direction enlargement process basically performs the same process as the row-direction enlargement process shown in FIG. 3 for each column, not for each row. That is, the font to be enlarged is divided for each column (step S11), cost calculation is performed for each column (step S12), ordering is performed for each column in ascending order of cost (step S14), and based on the enlargement ratio. The number of columns to be enlarged is determined (step S15), and enlargement processing is performed on the columns to be enlarged (step S16). In the cost calculation process shown in FIG. 4, the weighting of the cost considering the adjacent pixels in the vertical direction (step S22), the weighting considering the space (step S23), and the weighting of the columns having the same cost (step S24) Execute Also, in the enlargement process of this example, the target font is enlarged in the vertical and horizontal directions at the same enlargement ratio, so that the enlargement ratio used in step S15 is the same as the enlargement ratio used in the line-direction enlargement process. .
[0046]
When the enlargement processing is completed in the row direction and the column direction in this manner, the CPU 16 stores the obtained font, that is, the processing font in the processing font memory 14 (step S5) and displays it on the display unit 12 as necessary. Thus, the enlarged font is displayed on the display unit 12 of the mobile terminal device 10.
[0047]
As described above, in the font enlargement processing of the present invention, the cost is calculated for each row and column based on the configuration of the target font (the pattern of the font constituent pixels), and the appropriate row and column are enlarged based on the cost. I do. Specifically, by making the rows and columns close to the line segment difficult to enlarge, it is possible to prevent the line segment portion in the character from being enlarged more than necessary (step S22). Further, for a character having a large space at the end, it is prevented that only the space portion is enlarged and the character portion is not sufficiently enlarged (step S23). Further, when rows and columns having the same pattern are adjacent to each other, they are hardly enlarged, and only a specific part of the character is prevented from being enlarged more than necessary (step S24). With these processes, even in the case of a small font whose designated size is less than 19 dots, the balance is not unnatural and natural enlargement is possible in consideration of a pixel pattern constituting a character.
[0048]
The enlargement of the font by the cost method described above can be executed one character at a time when a character string to be displayed on the display unit 12 is determined. When the user specifies a change in the size of the display font or the like, the enlargement processing may be performed on all the character data prepared in advance in the font ROM 22 and the result may be stored in the processing font memory 14. . In any case, as described above, the font enlarging process itself requires only a simple calculation of an integer, so that the time required for the process is very short, and the processing time that the user feels uncomfortable is not required.
[0049]
(Ii) When font is reduced by cost method processing
Next, a case in which a font is reduced by the cost method will be described with reference to FIGS. FIGS. 8 and 9 are a flowchart of a main routine and a subroutine in the case where a font is reduced by the cost method processing. FIG. 10 is a diagram for explaining each process when the font is reduced by the cost method processing.
[0050]
The font reduction processing is basically performed in the same manner as the font enlargement processing. That is, when receiving the size designation information (step S41), the CPU 16 extracts the character base data closest to the designated size from the font ROM 22 and expands it on the RAM 24 which is a working memory (step S42).
[0051]
Note that the size specification information received in the case of reduction by the cost method processing is a case where the display font size is less than 19 dots, both when the user specifies and when the character display program automatically requests, and By reducing the character base data, the size is limited to a size that can most efficiently generate a font of the designated size.
[0052]
Next, the CPU 16 performs a row direction reduction process (step S43), and further performs a column direction reduction process (step S44). When the processing font is created, the CPU 16 stores the created processing font in the processing font memory 14 (step S45) and displays it as a display font on the display unit 12 (step S46). Thus, the font is reduced by the cost method processing.
[0053]
Next, a description will be given, with reference to FIG. 9, of a line-direction reduction process in font reduction by the cost method process. FIG. 9 is a flowchart of the row direction reduction process. The line-direction reduction processing shown in FIG. 9 is basically performed in the same procedure as the line-direction expansion processing in the case of expanding a font by the cost method processing shown in FIG. That is, the CPU 16 divides the target font into lines (step S51), calculates the cost for each line (step S52), and obtains the costs for all the lines (step S53; Yes). The rows are ordered in ascending order (step S54). Next, the CPU 16 determines the number of rows to be reduced based on the reduction rate (step S55), and performs a reduction process on the target row.
[0054]
As described above, the line-direction reduction processing in the font reduction processing is basically the same as the line-direction expansion processing in the font expansion processing. However, the line direction reduction processing in the font reduction processing differs from the case of the font enlargement processing in the cost calculation method in step S52 and the reduction method in step S56. Hereinafter, this will be described.
[0055]
First, the cost calculation will be described. The cost in the font enlarging process was a line segment amount, that is, a value indicating whether pixels included in each row or column are close to a line segment or a dot. On the other hand, the cost in the font reduction process is a value indicating the similarity, that is, how similar each row or column is to an adjacent row or column. Specifically, the CPU 16 calculates an exclusive OR (XOR) of each row with an adjacent row. The value of the exclusive OR is “0” when the neighboring pixels are the same, and becomes “1” when the neighboring pixels are different. Therefore, an exclusive OR is calculated for each font constituent pixel included in each row, and the number of font constituent elements whose value is “1” is set as the cost of the row. Thus, the higher the cost, the more dissimilar the font pixel pattern is between the row and the adjacent row, and the lower the cost, the more similar the pixel pixel pattern is between the row and the adjacent row. Thus, the cost is a value indicating the similarity (strictly speaking, dissimilarity) with the adjacent row.
[0056]
In other words, the lower cost of a row means that the font pixel pattern of that row is similar to the font pixel pattern of an adjacent row. Therefore, rows having similar pixel patterns are preferentially reduced, and similar rows are deleted. This is based on the idea that, when adjacent lines are similar to each other, even if the lines are preferentially deleted, the influence on the entire character and the sense of discomfort will be small. Thereby, natural reduction is possible.
[0057]
When the row direction reduction processing is completed, the column direction reduction processing is performed next (step S44), which is basically the same as the row direction reduction processing. The target font is divided into columns (step S51), and the cost is calculated for each column (step S52). When the costs are obtained for all the columns (step S53; Yes), the columns are ordered in ascending order of cost. (Step S54). Then, the CPU 16 determines the number of columns to be reduced based on the reduction ratio (step S55), and performs a reduction process on the target column.
[0058]
FIGS. 10A to 10C show the state of the column-direction reduction process. First, as shown in FIG. 10A, cost calculation is performed for each column, and then, as shown in FIG. 10B, columns are ordered in order of decreasing cost, and the columns are reduced in order from the column having the lowest cost. Be eligible. In the reduction processing of step S56, for example, as shown in FIG. 10C, the rows are deleted in order from the column with the lowest cost. In the example of FIG. 10C, three low-cost columns (A, B, and C) are deleted.
[0059]
As described above, in the font reduction by the cost method processing, the target font is divided in the row direction and the column direction, and the font is reduced in consideration of the similarity with the adjacent row or column. Therefore, even if the size of the display font is smaller than 19 dots, reduction (row or column deletion) is performed with priority given to a portion where rows or columns with similar font pixel patterns are adjacent to each other. Is less unnatural.
[0060]
FIGS. 11A and 11B show examples of enlarged / reduced fonts obtained by the address method processing described later and enlarged / reduced fonts obtained by the cost method processing. As can be seen from the figure, when a font having a size of less than 19 dots is displayed, the vertical and horizontal strokes of the enlarged / reduced font by the address method processing are doubled due to the enlargement (the horizontal line of the character “book”, “ The vertical line to the right of the word "skin") and diagonal lines appear jagged. Also, due to the reduction, the left and right balance of the character is lost (the left and right balance of the character “book”), or the pixels are connected to each other and look like another character (the left side of the character “skin” is Without any visible "eyes"). In contrast, in the font enlargement / reduction processing by the cost method processing, such a problem does not occur, and a natural enlargement / reduction font is obtained.
[0061]
[Address method processing]
Next, the enlargement / reduction of the font by the address method processing performed when the size specified by the user is 19 dots or more will be described. The address processing is performed by the CPU 16 executing the address processing program stored in the program ROM 20 as described above. Hereinafter, a case where the font is enlarged by the address method processing and a case where the font is reduced by the address method processing will be sequentially described.
[0062]
(I) When font is enlarged by address method processing
First, a case in which a font is enlarged by address processing will be described with reference to FIGS. FIG. 12 and FIG. 13 are a flowchart of a main routine and a subroutine for enlarging a font by address processing. FIGS. 14 to 17 are diagrams for explaining each step in the case of enlarging a font by the address method processing.
[0063]
Referring to FIG. 12, first, the CPU 16 receives size designation information (step S61). The size specification information is generated based on an instruction from the input unit 18 when, for example, the user operates the input unit 18 to specify, select, or specify or select a display font size. Further, even in cases other than the user's instruction, the size may be specified in accordance with the display content on the display unit 12.
[0064]
Note that the size specification information received when the enlargement is performed by the address method processing is such that the display font size is 19 dots or more and the character The size is limited to a size that can be generated most efficiently by enlarging the data.
[0065]
Upon receiving the size designation information, the CPU 16 reads the character data closest to the designated size from the font ROM 22, and expands the data into the RAM 24, which is a working memory (step S62). Specifically, if the size received as the size designation information is 29 dots, character data of 28 dots is read. On the other hand, when the size received as the enlargement instruction is 34 dots, character data of 32 dots is read.
[0066]
Then, the CPU 16 executes the enlargement process to enlarge the font to be enlarged, which is obtained by expanding the character data (step S63). Note that, in the case of this example, the enlargement ratios in the horizontal direction and the vertical direction are set to be the same. When the enlargement of the target font is completed in this way, the CPU 16 temporarily stores the enlarged font data as a processing font in the processing font memory 14 (step S64), and displays the font data on the display unit 12 as a display font. (Step S65).
[0067]
Next, details of the enlargement process performed in step S63 will be described. FIG. 13 is a flowchart showing the enlarging process in the address system process. Note that the addressing process is a process performed only when the size is enlarged to 19 dots or more. However, in the following description, for convenience, character data having a size of 8 dots is enlarged to 9 dots based on size designation information. It shall be.
[0068]
According to FIG. 13, first, the CPU 16 sets “1” as the x coordinate indicating the horizontal position of the character data expanded in the RAM 24 in step S62. Further, "1" is set as the y coordinate indicating the vertical position of the character base data. Accordingly, the CPU 16 sets the coordinates 30 (1, 1) as the reference coordinates (x, y) as the starting point when developing the processing font that is the font data after the enlargement, as shown in FIG. S71). Here, FIG. 14 is a diagram schematically showing the data structure of character base data having a size of 8 dots. The reference coordinates 30 (1, 1) specify a pixel 34 which is one of the constituent pixels constituting the character base data. In the case of character base data having a size of 8 dots, the number of constituent pixels is "8 * 8", which is 64.
[0069]
Next, the CPU 16 calculates the corresponding coordinates (x1, y1) based on the calculation formula “(x, y) * B / A = (x1, y1)” shown in FIG. 15A (step S72). . Here, the variable A is the size of the character base data. On the other hand, the variable B is the size received as the size information in step S61. That is, in this embodiment, the variable A is “8” and the variable B is “9”. Specifically, FIG. 15B shows a result obtained by associating “8” as the variable A and “9” as the variable B with the calculation formula shown in FIG. 15A. According to FIG. 15B, when the reference coordinates (x, y) are the coordinates 30 (1, 1), the corresponding coordinates (x1, y1) are (1.125, 1.125).
[0070]
Next, the CPU 16 determines a corresponding pixel based on the calculated corresponding coordinates (x1, y1) (step S73). FIG. 16 schematically shows the data structure of font data having a size of 9 dots. In FIG. 16A, the coordinates corresponding to the calculated corresponding coordinates (1.125, 1.125) are coordinates 35. Then, the CPU 16 determines that the corresponding pixel is the pixel 43 based on the corresponding coordinates 35 (1.125, 1.125). This is because, assuming a predetermined range 36 corresponding to the pixel 34 specified by the reference coordinates 30 shown in FIG. 14 based on the corresponding coordinates 35 (1.125, 1.125), the range 36 corresponds to the pixel 43. This is because they overlap most widely.
[0071]
Next, the CPU 16 develops the pattern of the pixel specified by the reference coordinates (x, y) as a processing font which is the font data after the enlargement (step S74). That is, the pattern of the pixel specified by the reference coordinates (x, y) is written to the area of the determined corresponding pixel. Specifically, the CPU 16 writes the value of the pixel 34 specified by the reference coordinates 30 (1, 1) shown in FIG. 14 into the area of the corresponding pixel 43 determined as shown in FIG.
[0072]
Then, the CPU 16 compares the value of the variable A with the x coordinate constituting the reference coordinates (step S75). Specifically, it is checked whether or not the value of the x coordinate is smaller than “8”. When the value of the x coordinate is smaller than the value of the variable A (Step S75; Yes), the CPU 16 adds “1” to the value of the x coordinate (Step S76), and returns to Step S72. Specifically, if the reference coordinates are (1, 1) at the time of step S75, the reference coordinates are set to (2, 1), and steps S72 to S75 are repeated.
[0073]
On the other hand, if the value of the x coordinate is equal to the value of the variable A, or if the value of the x coordinate is greater than the value of the variable A (step S75; No), the CPU 16 determines the value of the y coordinate and the value of the variable A as the reference coordinates. Are compared (step S77). Specifically, it is checked whether the value of the y coordinate is smaller than “8”. When the value of the y coordinate is smaller than the value of the variable A (Step S77; Yes), the CPU 16 adds “1” to the value of the y coordinate and initializes the value of the x coordinate to “1” (Step S78). It returns to step S72. Specifically, if the reference coordinates are (8, 1) at the time of step S77, “1” is added to the y-coordinate value, and the x-coordinate value is initialized to “1”, whereby the reference coordinates ( Set 1, 2). Then, the CPU 16 repeats the processing of steps S72 to S77.
[0074]
On the other hand, when the value of the y coordinate is equal to the value of the variable A, or when the value of the y coordinate is larger than the value of the variable A (Step S77; No), the CPU 16 completes the enlargement processing. Specifically, when the reference coordinates are (8, 8) at the time of step S77, the pattern of all the constituent pixels constituting the character data has been developed as the processing font which is the font data after the enlargement. The CPU 16 completes the enlargement processing.
[0075]
When the enlarging process is completed in this way, as shown in FIG. 12, the CPU 16 stores the processing font as shown in FIG. 17 obtained by the enlarging process in the processing font memory 14 (step S64) and displays it as necessary. It is displayed on the unit 12 (step S65).
[0076]
In step S73 of the enlarging process, there are cases where a plurality of corresponding pixels are determined. Specifically, when the reference coordinates (x, y) are coordinates 31 (1, 4) as shown in FIG. 14, according to the corresponding coordinate calculation result shown in FIG. y1) is (1.125, 4.5). In this case, in FIG. 16A, the coordinates corresponding to the corresponding coordinates (1.125, 4.5) are the coordinates 37. Therefore, assuming a predetermined range 38 corresponding to the pixel 36 specified by the reference coordinate 31 based on the corresponding coordinate 37, the range 38 overlaps the pixel 44 and the pixel 45 by the same area. Therefore, the CPU 16 determines the pixel 44 and the pixel 45 as the corresponding pixels in Step S73. As described above, when the font is enlarged by the address method processing, one specific pixel may have a plurality of corresponding pixels. As a result, even when the size is increased and the number of components is increased, it is possible to perform natural enlargement with a balanced character.
[0077]
(Ii) When font is reduced by address processing
Next, a case where the font is reduced by the address method processing will be described. The process of reducing the font by the address method is basically performed in the same manner as the process of enlarging the font. That is, when the CPU 16 receives the size designation information (step S61), the CPU 16 reads the character data closest to the designated size from the font ROM 22, and expands the data into the RAM 24 which is a working memory (step S62).
[0078]
Then, the CPU 16 executes a reduction process to reduce the font to be reduced by expanding the character data (step S63). Note that, in the case of this example, the enlargement ratios in the horizontal direction and the vertical direction are set to be the same. When the reduction of the target font is completed in this way, the CPU 16 temporarily stores the reduced font data as a processing font in the processing font memory 14 (step S64), and displays the font data on the display unit 12 as a display font. (Step S65).
[0079]
In step S73 of the reduction process, a predetermined value may already be written in the area of the determined corresponding pixel. In this case, since the value cannot be overwritten on the corresponding pixel, the CPU 1 skips step S74 and skips to step S75. Thus, even when the size is reduced and the number of constituent pixels is reduced, it is possible to perform a natural reduction with a balanced character.
[0080]
[Font transformation processing]
Next, the font transformation process will be described with reference to FIG. FIG. 18 is a flowchart of the font transformation process.
[0081]
Referring to FIG. 18, first, the CPU 16 receives size designation information (step S81). The size specification information is generated based on an instruction from the input unit 18 when, for example, the user operates the input unit 18 to specify, select, or specify or select a display font size and a display mode. Even in cases other than the user's instruction, the size may need to be specified according to the display content on the display unit 12.
[0082]
Next, the CPU 16 determines whether or not the size received as the size designation information is 19 dots or more (Step S82). If the size is less than 19 dots (Step S82; No), the CPU 16 performs the cost method processing (Step S83). On the other hand, if the size is equal to or larger than 19 dots (step S82; Yes), the CPU 16 performs an address method process (step S84). When the cost method processing or the address method processing is completed, the CPU 16 completes the font transformation processing.
[0083]
In the above embodiment, it is determined whether or not the size specified in step S82 is equal to or larger than 19 dots. If the size is smaller than 19 dots, cost method processing is performed, and if the size is smaller than 19 dots, If so, the address method processing is performed. However, in the present invention, the size serving as a criterion is not limited to 19 dots, and the designated size serving as a criterion can be arbitrarily set as long as deformation such as font enlargement / reduction can be performed naturally. It is possible to do.
[0084]
In the above embodiment, six types of sizes are used as character data. However, the present invention is not limited to this, and fonts of various designs such as Mincho and Gothic are used as character data. It is also possible to store it in the font ROM 22. That is, the character data can be arbitrarily set for both the design and the size. Normally, in a portable terminal device, if the size is 16 dots or more, Mincho and Gothic styles can be expressed, and if the size is 24 dots or more, all kanji strokes can be expressed. It is.
[0085]
Further, in the above-described embodiment, the font deformation process is performed using a square font having the same font aspect ratio. However, the present invention is not limited to this, and the aspect ratio may be arbitrarily set. It may be possible. For example, when the vertical enlargement ratio is large, a vertically long font can be generated, and when the horizontal enlargement ratio is large, a horizontally long font can be generated. Therefore, an arbitrary vertically long or horizontally long font can be generated only by storing a square font as character data in advance.
[0086]
As described above, according to the present invention, it is determined whether or not the font size specified by the user or the like is equal to or larger than a predetermined size serving as a determination criterion, and based on the result of the determination, cost method processing, or , Address system processing. That is, if the size is equal to or larger than the predetermined size serving as a determination criterion, a well-balanced font can be generated by enlarging / reducing the character data by the address method processing. On the other hand, if the size is smaller than a predetermined size serving as a criterion, font data can be enlarged / reduced by cost method processing to generate a font that does not cause unnatural thickness lines to appear. it can. In this manner, by enlarging or reducing the character base data by appropriate processing according to the size of the font to be generated, a well-balanced natural font can be displayed on the portable terminal device.
[0087]
Also, by enlarging / reducing several types of character data stored in the font ROM 22, a font of an arbitrary size can be generated. Therefore, compared with the case where fonts of all sizes that may be designated by the user are stored in the font ROM 22 in advance, it is possible to greatly reduce the amount of memory used.
[Brief description of the drawings]
FIG. 1 shows a schematic configuration of a portable terminal device to which enlargement / reduction processing is applied.
FIG. 2 is a flowchart in the case of enlargement by cost method processing.
FIG. 3 is a flowchart of a row (column) direction enlarging process in the cost method process.
FIG. 4 is a flowchart of a cost calculation process in the cost method process.
FIG. 5 is a diagram illustrating an example of a cost calculation process in the case of expanding character base data.
FIG. 6 is a diagram illustrating an example of a cost calculation process.
FIG. 7 is a diagram illustrating an example of a row (column) direction enlarging process.
FIG. 8 is a flowchart in the case of reduction by cost method processing.
FIG. 9 is a flowchart of a row (column) direction reduction process.
FIG. 10 is a diagram illustrating an example of a cost calculation process when character base data is reduced.
FIG. 11 is a diagram comparing the processing results of the cost method processing and the address method processing;
FIG. 12 is a flowchart of an address method process.
FIG. 13 is a flowchart of an enlargement (reduction) process in the address method process.
FIG. 14 is a diagram schematically illustrating a data structure of character base data having a size of 8 dots.
FIG. 15 shows a calculation formula for calculating corresponding coordinates, and a corresponding coordinate calculation result.
FIG. 16 is a diagram schematically illustrating a data structure of character base data having a size of 9 dots.
FIG. 17 is a diagram schematically illustrating a data structure of a processing font after enlargement.
FIG. 18 is a flowchart of a font transformation process.
[Explanation of symbols]
10 portable terminal device, 12 display unit, 14 processing font memory, 16 CPU, 18 input unit, 20 program ROM, 22 font ROM, 24 RAM,

Claims (6)

ビットマップフォントのフォントデータを字母データとして記憶する字母データ記憶手段と、
指定されたフォントのサイズを含むサイズ指定情報を取得するサイズ指定情報取得手段と、
前記サイズ指定情報に含まれる前記サイズと基準サイズを比較するサイズ比較手段と、
前記サイズ指定情報に含まれる前記サイズに基づいて、前記字母データ記憶手段が記憶した前記字母データを取得する字母データ取得手段と、
前記サイズ比較手段の比較結果及び前記サイズに基づいて、前記字母データ取得手段が取得した前記字母データを拡大又は縮小する拡大/縮小手段と、を備えることを特徴とするフォント処理装置。
Character data storage means for storing font data of the bitmap font as character data;
Size designation information acquisition means for acquiring size designation information including the size of the designated font;
Size comparison means for comparing the size included in the size designation information with a reference size,
Character data acquisition means for acquiring the character data stored by the character data storage means based on the size included in the size designation information,
A font processing apparatus comprising: a scaling unit that scales up or down the character data acquired by the character data acquisition unit based on the comparison result of the size comparison unit and the size.
前記拡大/縮小手段は、
前記サイズ比較手段の比較結果、前記サイズ指定情報に含まれる前記サイズが前記基準サイズより小さい場合に、前記字母データの画素構成の特徴を示すコストに基づいて前記字母データを拡大又は縮小するコスト方式拡大/縮小手段と、
前記サイズ比較手段の比較結果、前記サイズ指定情報に含まれる前記サイズが前記基準サイズより大きい場合に、前記字母データの縦横比であるアドレスに基づいて座標を変換することにより前記字母データを拡大又は縮小するアドレス方式拡大/縮小手段と、をさらに備えることを特徴とする請求項1に記載のフォント処理装置。
The enlargement / reduction means includes:
A cost method for enlarging or reducing the character data based on a cost indicating a characteristic of a pixel configuration of the character data when the size included in the size designation information is smaller than the reference size as a result of comparison by the size comparing means; Enlargement / reduction means;
As a result of the comparison by the size comparing means, if the size included in the size designation information is larger than the reference size, the character data is enlarged or converted by converting coordinates based on an address that is an aspect ratio of the character data. 2. The font processing apparatus according to claim 1, further comprising: an address method enlarging / reducing means for reducing.
前記字母データ記憶手段は、複数のサイズ及び/又は複数のデザインのフォントデータを前記字母データとして記憶しており、
前記基準サイズは、前記デザインの判別が可能なサイズであることを特徴とする請求項1又は2に記載のフォント処理装置。
The character data storage means stores font data of a plurality of sizes and / or a plurality of designs as the character data,
The font processing apparatus according to claim 1, wherein the reference size is a size from which the design can be determined.
前記請求項1乃至3のいずれか一項のフォント処理装置と、
前記フォント処理装置により生成されたフォントデータを記憶する記憶手段と、
前記フォント処理装置により生成されたフォントデータを表示する表示部とを備えることを特徴とする端末装置。
4. The font processing device according to claim 1,
Storage means for storing font data generated by the font processing device;
A display unit for displaying font data generated by the font processing device.
ビットマップフォントのフォントデータを字母データとして記憶する字母データ記憶工程と、
指定されたフォントのサイズを含むサイズ指定情報を取得するサイズ指定情報取得工程と、
前記サイズ指定情報に含まれる前記サイズと基準サイズを比較するサイズ比較工程と、
前記サイズ指定情報に含まれる前記サイズに基づいて、前記字母データ記憶手段が記憶した前記字母データを取得する字母データ取得工程と、
前記サイズ比較手段の比較結果及び前記サイズに基づいて、前記字母データ取得手段が取得した前記字母データを拡大又は縮小する拡大/縮小工程と、を有することを特徴とするフォント処理方法。
A character data storage step of storing font data of the bitmap font as character data;
A size specification information obtaining step of obtaining size specification information including the size of the specified font;
A size comparison step of comparing the size included in the size designation information with a reference size,
A character data acquisition step of acquiring the character data stored by the character data storage means based on the size included in the size designation information;
A font processing method, comprising: an enlargement / reduction step of enlarging or reducing the character data acquired by the character data acquisition device based on the comparison result of the size comparison device and the size.
コンピュータを備える端末装置において実行されるフォント処理プログラムであって、前記コンピュータを、
ビットマップフォントのフォントデータを字母データとして記憶する字母データ記憶手段、
指定されたフォントのサイズを含むサイズ指定情報を取得するサイズ指定情報取得手段、
前記サイズ指定情報に含まれる前記サイズと基準サイズを比較するサイズ比較手段、
前記サイズ指定情報に含まれる前記サイズに基づいて、前記字母データ記憶手段が記憶した前記字母データを取得する字母データ取得手段、
前記サイズ比較手段の比較結果及び前記サイズに基づいて、前記字母データ取得手段が取得した前記字母データを拡大又は縮小する拡大/縮小手段、として機能させることを特徴とするフォント処理プログラム。
A font processing program executed in a terminal device including a computer, the computer comprising:
Character data storage means for storing font data of the bitmap font as character data;
Size specification information obtaining means for obtaining size specification information including a specified font size,
Size comparing means for comparing the size included in the size designation information with a reference size,
Character data acquisition means for acquiring the character data stored in the character data storage means, based on the size included in the size designation information,
A font processing program functioning as enlargement / reduction means for enlarging or reducing the character data acquired by the character data acquisition means based on the comparison result of the size comparison means and the size.
JP2003009909A 2003-01-17 2003-01-17 Font processing device, terminal device, font processing method and font processing program Withdrawn JP2004219937A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2003009909A JP2004219937A (en) 2003-01-17 2003-01-17 Font processing device, terminal device, font processing method and font processing program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2003009909A JP2004219937A (en) 2003-01-17 2003-01-17 Font processing device, terminal device, font processing method and font processing program

Publications (1)

Publication Number Publication Date
JP2004219937A true JP2004219937A (en) 2004-08-05

Family

ID=32899263

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2003009909A Withdrawn JP2004219937A (en) 2003-01-17 2003-01-17 Font processing device, terminal device, font processing method and font processing program

Country Status (1)

Country Link
JP (1) JP2004219937A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2008096645A (en) * 2006-10-11 2008-04-24 Koyo Electronics Ind Co Ltd Display size varying method for bit map object

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2008096645A (en) * 2006-10-11 2008-04-24 Koyo Electronics Ind Co Ltd Display size varying method for bit map object

Similar Documents

Publication Publication Date Title
JP4124494B2 (en) Replacement computer font supply method and apparatus
US7773089B2 (en) Displaying character strings based on font information
JPH03208094A (en) Treatment of outline of symbol image of various sizes and computor display device
US9659547B2 (en) Method and device for displaying images and text in accordance with a selected pattern
JP2008158765A (en) Information processing device, information processing method, and program for executing it by computer
KR100517162B1 (en) Font processor, terminal device, font processing method and recording medium recording the font processing program
JP3353954B2 (en) Handwriting input display method and handwriting input display device
US20090303258A1 (en) Information display apparatus, information displaying method, and computer readable medium
JP2004219937A (en) Font processing device, terminal device, font processing method and font processing program
JP3815411B2 (en) Font processing device, terminal device, display device, font processing method, and font processing program
JP3815412B2 (en) Font processing device, terminal device, display device, font processing method, and font processing program
JP2004126555A (en) Font processor, terminal device, and font processing method and program
JP2005092567A (en) Scroll controller, scroll control method, scroll control program, and recording medium
JP2004133401A (en) Font processing device, terminal, font processing method, and font processing program
JP2006259662A (en) Method for forming bitmap character by scaling bitmap bit stroke data
EP1835415A1 (en) Display, display control method, and information storage medium
JP6253387B2 (en) Character size acquisition device, character size acquisition method, and character size acquisition program
JP3247809B2 (en) Document processing device
JP4884004B2 (en) Character display method, apparatus and program
JPH0728842A (en) Information retrieval device
JP3139955B2 (en) Information processing method and apparatus
CN115291984A (en) Display method, device, equipment and storage medium of vehicle instrument
JPH09325753A (en) Display device
JPH06266340A (en) Character display device
JPH11282962A (en) Character recognition device and computer readable storage medium recording character recognition program

Legal Events

Date Code Title Description
A300 Withdrawal of application because of no request for examination

Free format text: JAPANESE INTERMEDIATE CODE: A300

Effective date: 20060404