diff --git a/LICENSES b/LICENSES index 3bcdb3a..b9cf1f0 100644 --- a/LICENSES +++ b/LICENSES @@ -5,23 +5,14 @@ License: GNU GPLv3 or later ------------------------------------------------------------------------ -data/DroidSansFallbackFull.ttf +data/TakaoGothic.ttf -Source: https://packages.debian.org/sid/fonts-droid-fallback +Source: https://packages.debian.org/sid/fonts-takao-gothic -Copyright © 2006, 2007, 2008, 2009, 2010 Google Corp. +Copyright (C) 2007-2015 Information-technology Promotion Agency, Japan. +Copyright (C) 2010-2015 Takao Fonts Maintainers Team -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. +License: IPA Font License (Full text found under data/ipa_font_license.txt) ------------------------------------------------------------------------ diff --git a/data/DroidSansFallbackFull.ttf b/data/DroidSansFallbackFull.ttf deleted file mode 100644 index 89959f5..0000000 Binary files a/data/DroidSansFallbackFull.ttf and /dev/null differ diff --git a/data/TakaoGothic.ttf b/data/TakaoGothic.ttf new file mode 100644 index 0000000..54e7ae9 Binary files /dev/null and b/data/TakaoGothic.ttf differ diff --git a/data/ipa_font_license.txt b/data/ipa_font_license.txt new file mode 100644 index 0000000..cb21c4a --- /dev/null +++ b/data/ipa_font_license.txt @@ -0,0 +1,238 @@ +IPAフォントライセンスv1.0 + +許諾者は、この使用許諾(以下「本契約」といいます。)に定める条件の下で、許諾プログラム(1条に定義するところによります。)を提供します。受領者(1条に定義するところによります。)が、許諾プログラムを使用し、複製し、または頒布する行為、その他、本契約に定める権利の利用を行った場合、受領者は本契約に同意したものと見なします。 + +第1条 用語の定義 + +本契約において、次の各号に掲げる用語は、当該各号に定めるところによります。 + +1. 「デジタル・フォント・プログラム」とは、フォントを含み、レンダリングしまたは表示するために用いられるコンピュータ・プログラムをいいます。 +2. 「許諾プログラム」とは、許諾者が本契約の下で許諾するデジタル・フォント・プログラムをいいます。 +3. 「派生プログラム」とは、許諾プログラムの一部または全部を、改変し、加除修正等し、入れ替え、その他翻案したデジタル・フォント・プログラムをいい、許諾プログラムの一部もしくは全部から文字情報を取り出し、またはデジタル・ドキュメント・ファイルからエンベッドされたフォントを取り出し、取り出された文字情報をそのまま、または改変をなして新たなデジタル・フォント・プログラムとして製作されたものを含みます。 +4. 「デジタル・コンテンツ」とは、デジタル・データ形式によってエンド・ユーザに提供される制作物のことをいい、動画・静止画等の映像コンテンツおよびテレビ番組等の放送コンテンツ、ならびに文字テキスト、画像、図形等を含んで構成された制作物を含みます。 +5. 「デジタル・ドキュメント・ファイル」とは、PDFファイルその他、各種ソフトウェア・プログラムによって製作されたデジタル・コンテンツであって、その中にフォントを表示するために許諾プログラムの全部または一部が埋め込まれた(エンベッドされた)ものをいいます。フォントが「エンベッドされた」とは、当該フォントが埋め込まれた特定の「デジタル・ドキュメント・ファイル」においてのみ表示されるために使用されている状態を指し、その特定の「デジタル・ドキュメント・ファイル」以外でフォントを表示するために使用できるデジタル・フォント・プログラムに含まれている場合と区別されます。 +6. 「コンピュータ」とは、本契約においては、サーバを含みます。 +7. 「複製その他の利用」とは、複製、譲渡、頒布、貸与、公衆送信、上映、展示、翻案その他の利用をいいます。 +8. 「受領者」とは、許諾プログラムを本契約の下で受領した人をいい、受領者から許諾プログラムを受領した人を含みます。 + +第2条 使用許諾の付与 + +許諾者は受領者に対し、本契約の条項に従い、すべての国で、許諾プログラムを使用することを許諾します。ただし、許諾プログラムに存在する一切の権利はすべて許諾者が保有しています。本契約は、本契約で明示的に定められている場合を除き、いかなる意味においても、許諾者が保有する許諾プログラムに関する一切の権利および、いかなる商標、商号、もしくはサービス・マークに関する権利をも受領者に移転するものではありません。 + +1. 受領者は本契約に定める条件に従い、許諾プログラムを任意の数のコンピュータにインストールし、当該コンピュータで使用することができます。 +2. 受領者はコンピュータにインストールされた許諾プログラムをそのまま、または改変を行ったうえで、印刷物およびデジタル・コンテンツにおいて、文字テキスト表現等として使用することができます。 +3. 受領者は前項の定めに従い作成した印刷物およびデジタル・コンテンツにつき、その商用・非商用の別、および放送、通信、各種記録メディアなどの媒体の形式を問わず、複製その他の利用をすることができます。 +4. 受領者がデジタル・ドキュメント・ファイルからエンベッドされたフォントを取り出して派生プログラムを作成した場合には、かかる派生プログラムは本契約に定める条件に従う必要があります。 +5. 許諾プログラムのエンベッドされたフォントがデジタル・ドキュメント・ファイル内のデジタル・コンテンツをレンダリングするためにのみ使用される場合において、受領者が当該デジタル・ドキュメント・ファイルを複製その他の利用をする場合には、受領者はかかる行為に関しては本契約の下ではいかなる義務をも負いません。 +6. 受領者は、3条2項の定めに従い、商用・非商用を問わず、許諾プログラムをそのままの状態で改変することなく複製して第三者への譲渡し、公衆送信し、その他の方法で再配布することができます(以下、「再配布」といいます。)。 +7. 受領者は、上記の許諾プログラムについて定められた条件と同様の条件に従って、派生プログラムを作成し、使用し、複製し、再配布することができます。ただし、受領者が派生プログラムを再配布する場合には、3条1項の定めに従うものとします。 + +第3条 制限 + +前条により付与された使用許諾は、以下の制限に服します。 + +1. 派生プログラムが前条4項及び7項に基づき再配布される場合には、以下の全ての条件を満たさなければなりません。 + - (1) + 派生プログラムを再配布する際には、下記もまた、当該派生プログラムと一緒に再配布され、オンラインで提供され、または、郵送費・媒体及び取扱手数料の合計を超えない実費と引き換えに媒体を郵送する方法により提供されなければなりません。 + - (a) 派生プログラムの写し; および + - (b) + 派生プログラムを作成する過程でフォント開発プログラムによって作成された追加のファイルであって派生プログラムをさらに加工するにあたって利用できるファイルが存在すれば、当該ファイル + - (2) + 派生プログラムの受領者が、派生プログラムを、このライセンスの下で最初にリリースされた許諾プログラム(以下、「オリジナル・プログラム」といいます。)に置き換えることができる方法を再配布するものとします。かかる方法は、オリジナル・ファイルからの差分ファイルの提供、または、派生プログラムをオリジナル・プログラムに置き換える方法を示す指示の提供などが考えられます。 + - (3) + 派生プログラムを、本契約書に定められた条件の下でライセンスしなければなりません。 + - (4) + 派生プログラムのプログラム名、フォント名またはファイル名として、許諾プログラムが用いているのと同一の名称、またはこれを含む名称を使用してはなりません。 + - (5) + 本項の要件を満たすためにオンラインで提供し、または媒体を郵送する方法で提供されるものは、その提供を希望するいかなる者によっても提供が可能です。 + +2. 受領者が前条6項に基づき許諾プログラムを再配布する場合には、以下の全ての条件を満たさなければなりません。 + - (1) 許諾プログラムの名称を変更してはなりません。 + - (2) 許諾プログラムに加工その他の改変を加えてはなりません。 + - (3) 本契約の写しを許諾プログラムに添付しなければなりません。 + +3. 許諾プログラムは、現状有姿で提供されており、許諾プログラムまたは派生プログラムについて、許諾者は一切の明示または黙示の保証(権利の所在、非侵害、商品性、特定目的への適合性を含むがこれに限られません)を行いません。いかなる場合にも、その原因を問わず、契約上の責任か厳格責任か過失その他の不法行為責任かにかかわらず、また事前に通知されたか否かにかかわらず、許諾者は、許諾プログラムまたは派生プログラムのインストール、使用、複製その他の利用または本契約上の権利の行使によって生じた一切の損害(直接・間接・付随的・特別・拡大・懲罰的または結果的損害)(商品またはサービスの代替品の調達、システム障害から生じた損害、現存するデータまたはプログラムの紛失または破損、逸失利益を含むがこれに限られません)について責任を負いません。 +4. 許諾プログラムまたは派生プログラムのインストール、使用、複製その他の利用に関して、許諾者は技術的な質問や問い合わせ等に対する対応その他、いかなるユーザ・サポートをも行う義務を負いません。 + +第4条 契約の終了 + +1. 本契約の有効期間は、受領者が許諾プログラムを受領した時に開始し、受領者が許諾プログラムを何らかの方法で保持する限り続くものとします。 +2. 前項の定めにかかわらず、受領者が本契約に定める各条項に違反したときは、本契約は、何らの催告を要することなく、自動的に終了し、当該受領者はそれ以後、許諾プログラムおよび派生プログラムを一切使用しまたは複製その他の利用をすることができないものとします。ただし、かかる契約の終了は、当該違反した受領者から許諾プログラムまたは派生プログラムの配布を受けた受領者の権利に影響を及ぼすものではありません。 + +第5条 準拠法 + +1. IPAは、本契約の変更バージョンまたは新しいバージョンを公表することができます。その場合には、受領者は、許諾プログラムまたは派生プログラムの使用、複製その他の利用または再配布にあたり、本契約または変更後の契約のいずれかを選択することができます。その他、上記に記載されていない条項に関しては日本の著作権法および関連法規に従うものとします。 +2. 本契約は、日本法に基づき解釈されます。 + +* * * * * + +IPA Font License Agreement v1.0 + +The Licensor provides the Licensed Program (as defined in Article 1 +below) under the terms of this license agreement (“Agreement”). Any +use, reproduction or distribution of the Licensed Program, or any +exercise of rights under this Agreement by a Recipient (as defined in +Article 1 below) constitutes the Recipient’s acceptance of this +Agreement. + +Article 1 (Definitions) + +1. “Digital Font Program” shall mean a computer program containing, or + used to render or display fonts. +2. “Licensed Program” shall mean a Digital Font Program licensed by the + Licensor under this Agreement. +3. “Derived Program” shall mean a Digital Font Program created as a + result of a modification, addition, deletion, replacement or any + other adaptation to or of a part or all of the Licensed Program, and + includes a case where a Digital Font Program newly created by + retrieving font information from a part or all of the Licensed + Program or Embedded Fonts from a Digital Document File with or + without modification of the retrieved font information. +4. “Digital Content” shall mean products provided to end users in the + form of digital data, including video content, motion and/or still + pictures, TV programs or other broadcasting content and products + consisting of character text, pictures, photographic images, graphic + symbols and/or the like. +5. “Digital Document File” shall mean a PDF file or other Digital + Content created by various software programs in which a part or all + of the Licensed Program becomes embedded or contained in the file + for the display of the font (“Embedded Fonts”). Embedded Fonts are + used only in the display of characters in the particular Digital + Document File within which they are embedded, and shall be + distinguished from those in any Digital Font Program, which may be + used for display of characters outside that particular Digital + Document File. +6. “Computer” shall include a server in this Agreement. +7. “Reproduction and Other Exploitation” shall mean reproduction, + transfer, distribution, lease, public transmission, presentation, + exhibition, adaptation and any other exploitation. +8. “Recipient” shall mean anyone who receives the Licensed Program + under this Agreement, including one that receives the Licensed + Program from a Recipient. + +Article 2 (Grant of License) + +The Licensor grants to the Recipient a license to use the Licensed +Program in any and all countries in accordance with each of the +provisions set forth in this Agreement. However, any and all rights +underlying in the Licensed Program shall be held by the Licensor. In no +sense is this Agreement intended to transfer any right relating to the +Licensed Program held by the Licensor except as specifically set forth +herein or any right relating to any trademark, trade name, or service +mark to the Recipient. + +1. The Recipient may install the Licensed Program on any number of + Computers and use the same in accordance with the provisions set + forth in this Agreement. +2. The Recipient may use the Licensed Program, with or without + modification in printed materials or in Digital Content as an + expression of character texts or the like. +3. The Recipient may conduct Reproduction and Other Exploitation of the + printed materials and Digital Content created in accordance with the + preceding Paragraph, for commercial or non-commercial purposes and + in any form of media including but not limited to broadcasting, + communication and various recording media. +4. If any Recipient extracts Embedded Fonts from a Digital Document + File to create a Derived Program, such Derived Program shall be + subject to the terms of this agreement. +5. If any Recipient performs Reproduction or Other Exploitation of a + Digital Document File in which Embedded Fonts of the Licensed + Program are used only for rendering the Digital Content within such + Digital Document File then such Recipient shall have no further + obligations under this Agreement in relation to such actions. +6. The Recipient may reproduce the Licensed Program as is without + modification and transfer such copies, publicly transmit or + otherwise redistribute the Licensed Program to a third party for + commercial or non-commercial purposes (“Redistribute”), in + accordance with the provisions set forth in Article 3 Paragraph 2. +7. The Recipient may create, use, reproduce and/or Redistribute a + Derived Program under the terms stated above for the Licensed + Program: provided, that the Recipient shall follow the provisions + set forth in Article 3 Paragraph 1 when Redistributing the Derived + Program. + +Article 3 (Restriction) + +The license granted in the preceding Article shall be subject to the +following restrictions: + +1. If a Derived Program is Redistributed pursuant to Paragraph 4 and 7 + of the preceding Article, the following conditions must be met : + - (1)The following must be also Redistributed together with the + Derived Program, or be made available online or by means of + mailing mechanisms in exchange for a cost which does not exceed + the total costs of postage, storage medium and handling fees: + - (a)a copy of the Derived Program; and + - (b)any additional file created by the font developing + program in the course of creating the Derived Program that + can be used for further modification of the Derived Program, + if any. + - (2)It is required to also Redistribute means to enable + recipients of the Derived Program to replace the Derived Program + with the Licensed Program first released under this License (the + “Original Program”). Such means may be to provide a difference + file from the Original Program, or instructions setting out a + method to replace the Derived Program with the Original Program. + - (3)The Recipient must license the Derived Program under the + terms and conditions of this Agreement. + - (4)No one may use or include the name of the Licensed Program as + a program name, font name or file name of the Derived Program. + - (5) Any material to be made available online or by means of + mailing a medium to satisfy the requirements of this paragraph + may be provided, verbatim, by any party wishing to do so. + +2. If the Recipient Redistributes the Licensed Program pursuant to + Paragraph 6 of the preceding Article, the Recipient shall meet all + of the following conditions: + - (1)The Recipient may not change the name of the Licensed + Program. + - (2)The Recipient may not alter or otherwise modify the Licensed + Program. + - (3)The Recipient must attach a copy of this Agreement to the + Licensed Program. + +3. THIS LICENSED PROGRAM IS PROVIDED BY THE LICENSOR “AS IS” AND ANY + EXPRESSED OR IMPLIED WARRANTY AS TO THE LICENSED PROGRAM OR ANY + DERIVED PROGRAM, INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF TITLE, + NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR + PURPOSE, ARE DISCLAIMED. IN NO EVENT SHALL THE LICENSOR BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXTENDED, EXEMPLARY, + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO; PROCUREMENT + OF SUBSTITUTED GOODS OR SERVICE; DAMAGES ARISING FROM SYSTEM + FAILURE; LOSS OR CORRUPTION OF EXISTING DATA OR PROGRAM; LOST + PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE INSTALLATION, USE, THE + REPRODUCTION OR OTHER EXPLOITATION OF THE LICENSED PROGRAM OR ANY + DERIVED PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, + EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. +4. The Licensor is under no obligation to respond to any technical + questions or inquiries, or provide any other user support in + connection with the installation, use or the Reproduction and Other + Exploitation of the Licensed Program or Derived Programs thereof. + +Article 4 (Termination of Agreement) + +1. The term of this Agreement shall begin from the time of receipt of + the Licensed Program by the Recipient and shall continue as long as + the Recipient retains any such Licensed Program in any way. +2. Notwithstanding the provision set forth in the preceding Paragraph, + in the event of the breach of any of the provisions set forth in + this Agreement by the Recipient, this Agreement shall automatically + terminate without any notice. In the case of such termination, the + Recipient may not use or conduct Reproduction and Other Exploitation + of the Licensed Program or a Derived Program: provided that such + termination shall not affect any rights of any other Recipient + receiving the Licensed Program or the Derived Program from such + Recipient who breached this Agreement. + +Article 5 (Governing Law) + +1. IPA may publish revised and/or new versions of this License. In such + an event, the Recipient may select either this Agreement or any + subsequent version of the Agreement in using, conducting the + Reproduction and Other Exploitation of, or Redistributing the + Licensed Program or a Derived Program. Other matters not specified + above shall be subject to the Copyright Law of Japan and other + related laws and regulations of Japan. +2. This Agreement shall be construed under the laws of Japan. diff --git a/src/gfx.c b/src/gfx.c index 6936f08..c7cb97c 100644 --- a/src/gfx.c +++ b/src/gfx.c @@ -89,12 +89,13 @@ void gfx_init() exit(1); } - gfx_unicodeFont = TTF_OpenFont("data/DroidSansFallbackFull.ttf", 14); + gfx_unicodeFont = TTF_OpenFont("data/TakaoGothic.ttf", 14); if (gfx_unicodeFont == NULL) { printf("ERROR: TTF_OpenFont: %s\n", TTF_GetError()); exit(1); } + TTF_SetFontStyle(gfx_unicodeFont, TTF_STYLE_BOLD); #endif } @@ -279,7 +280,6 @@ int gfx_renderUnicodeBase(const char *in, int x, int y, int fontColor, int wrap, color.g = 255; color.b = 255; } - printf("Color appears to be: %d %d %d\n", color.r, color.g, color.b); if (gfx_unicodeFont != NULL) { @@ -308,17 +308,14 @@ int gfx_renderUnicodeBase(const char *in, int x, int y, int fontColor, int wrap, changed = 0; for (i = nBreakPoints - 1; i >= 0; i--) { - printf("Breakpoint %d (%c)\n", i, remainingStr[breakPoints[i]]); strncpy(testStr, remainingStr, breakPoints[i]); testStr[breakPoints[i]] = '\0'; - printf("Checking '%s'...\n", testStr); if (TTF_SizeUTF8(gfx_unicodeFont, testStr, &w, &h) < 0) { engine_error(TTF_GetError()); } if (w <= dest->w) { - printf("Under designated width. Render '%s'\n", testStr); textSurf = TTF_RenderUTF8_Solid(gfx_unicodeFont, testStr, color); area.x = x; area.y = y; @@ -345,7 +342,6 @@ int gfx_renderUnicodeBase(const char *in, int x, int y, int fontColor, int wrap, engine_error(TTF_GetError()); } } - printf("Done splitting. Render '%s'\n", remainingStr); textSurf = TTF_RenderUTF8_Solid(gfx_unicodeFont, remainingStr, color); area.x = x; area.y = y; @@ -569,7 +565,10 @@ SDL_Surface *gfx_createAlphaRect(int width, int height, Uint8 red, Uint8 green, void gfx_createMessageBox(SDL_Surface *face, const char *message, int transparent) { - int x = 60; + int border = 5; + int x = border; + int y = border; + SDL_Surface *textArea; if (gfx_messageBox != NULL) { @@ -585,15 +584,20 @@ void gfx_createMessageBox(SDL_Surface *face, const char *message, int transparen if (face != NULL) { gfx_drawRect(gfx_messageBox, 0, 0, gfx_messageBox->w - 1, gfx_messageBox->h - 1, 0x00, 0x00, 0xaa); - gfx_blit(face, 5, 5, gfx_messageBox); + gfx_blit(face, border, border, gfx_messageBox); + x = (2 * border) + face->w; } else { gfx_drawRect(gfx_messageBox, 0, 0, gfx_messageBox->w - 1, gfx_messageBox->h - 1, 0x00, 0x00, 0x00); - x = 10; + x = border; } - - gfx_renderUnicode(message, x, 5, FONT_WHITE, 1, gfx_messageBox); + + textArea = gfx_createSurface(gfx_messageBox->w - (x + border), gfx_messageBox->h - y); + gfx_renderUnicode(message, 0, 0, FONT_WHITE, 1, textArea); + gfx_blit(textArea, x, y, gfx_messageBox); + SDL_FreeSurface(textArea); + textArea = NULL; } SDL_Surface *gfx_loadImage(const char *filename)