Andrew Reed / Mbed OS CITY1082-i2c_master_wifi_mqtt
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers FONT_ShiftJIS.c Source File

FONT_ShiftJIS.c

00001 /*********************************************************************
00002 *                SEGGER Microcontroller GmbH                         *
00003 *        Solutions for real time microcontroller applications        *
00004 **********************************************************************
00005 *                                                                    *
00006 *        (c) 1996 - 2018  SEGGER Microcontroller GmbH                *
00007 *                                                                    *
00008 *        Internet: www.segger.com    Support:  support@segger.com    *
00009 *                                                                    *
00010 **********************************************************************
00011 
00012 ** emWin V5.48 - Graphical user interface for embedded applications **
00013 All  Intellectual Property rights  in the Software belongs to  SEGGER.
00014 emWin is protected by  international copyright laws.  Knowledge of the
00015 source code may not be used to write a similar product.  This file may
00016 only be used in accordance with the following terms:
00017 
00018 The software  has been licensed to  Cypress Semiconductor Corporation,
00019 whose registered  office is situated  at 198 Champion Ct. San Jose, CA 
00020 95134 USA  solely for the  purposes of creating  libraries for Cypress
00021 PSoC3 and  PSoC5 processor-based devices,  sublicensed and distributed
00022 under  the  terms  and  conditions  of  the  Cypress  End User License
00023 Agreement.
00024 Full source code is available at: www.segger.com
00025 
00026 We appreciate your understanding and fairness.
00027 ----------------------------------------------------------------------
00028 Licensing information
00029 Licensor:                 SEGGER Microcontroller Systems LLC
00030 Licensed to:              Cypress Semiconductor Corp, 198 Champion Ct., San Jose, CA 95134, USA
00031 Licensed SEGGER software: emWin
00032 License number:           GUI-00319
00033 License model:            Services and License Agreement, signed June 10th, 2009
00034 Licensed platform:        Any Cypress platform (Initial targets are: PSoC3, PSoC5)
00035 ----------------------------------------------------------------------
00036 Support and Update Agreement (SUA)
00037 SUA period:               2009-06-12 - 2022-07-27
00038 Contact to extend SUA:    sales@segger.com
00039 ----------------------------------------------------------------------
00040 File        : FONT_ShiftJIS.c
00041 Purpose     : Example demonstrating ShiftJIS capabilities of emWin
00042 Requirements: WindowManager - ( )
00043               MemoryDevices - ( )
00044               AntiAliasing  - ( )
00045               VNC-Server    - ( )
00046               PNG-Library   - ( )
00047               TrueTypeFonts - ( )
00048 ----------------------------------------------------------------------
00049 */
00050 
00051 #include "GUI.h"
00052 
00053 /*********************************************************************
00054 *
00055 *       Defines
00056 *
00057 **********************************************************************
00058 */
00059 //
00060 // Recommended memory to run the sample with adequate performance
00061 //
00062 #define RECOMMENDED_MEMORY (1024L * 5)
00063 
00064 /*******************************************************************
00065 *
00066 *              Definition of ShiftJIS font
00067 *
00068 ********************************************************************
00069 */
00070 //
00071 // LATIN CAPITAL LETTER A
00072 //
00073 static const unsigned char acFontSJIS13_0041[ 13] = { // Code 0041
00074   ________,
00075   ________,
00076   ___X____,
00077   ___X____,
00078   __X_X___,
00079   __X_X___,
00080   __X_X___,
00081   _XXXXX__,
00082   _X___X__,
00083   _X___X__,
00084   XXX_XXX_,
00085   ________,
00086   ________};
00087 
00088 //
00089 // LATIN CAPITAL LETTER B
00090 //
00091 static const unsigned char acFontSJIS13_0042[ 13] = { // Code 0042
00092   ________,
00093   ________,
00094   XXXXX___,
00095   _X___X__,
00096   _X___X__,
00097   _X___X__,
00098   _XXXX___,
00099   _X___X__,
00100   _X___X__,
00101   _X___X__,
00102   XXXXX___,
00103   ________,
00104   ________};
00105 
00106 //
00107 // LATIN CAPITAL LETTER C
00108 //
00109 static const unsigned char acFontSJIS13_0043[ 13] = { // Code 0043
00110   ________,
00111   ________,
00112   __XX_X__,
00113   _X__XX__,
00114   X____X__,
00115   X_______,
00116   X_______,
00117   X_______,
00118   X_______,
00119   _X___X__,
00120   __XXX___,
00121   ________,
00122   ________};
00123 
00124 //
00125 // KATAKANA LETTER KE
00126 //
00127 static const unsigned char acFontSJIS13_8350[ 26] = { // Code 8350
00128   __XX____,________,
00129   ___X____,________,
00130   ___X____,________,
00131   ___XXXXX,XXXX____,
00132   __X____X,________,
00133   _X_____X,________,
00134   X______X,________,
00135   ______X_,________,
00136   ______X_,________,
00137   _____X__,________,
00138   ____X___,________,
00139   __XX____,________,
00140   ________,________};
00141 
00142 //
00143 // KATAKANA LETTER GE
00144 //
00145 static const unsigned char acFontSJIS13_8351[ 26] = { // Code 8351
00146   __XX____,X_X_____,
00147   ___X____,_X_X____,
00148   ___X____,________,
00149   __XXXXXX,XXX_____,
00150   __X____X,________,
00151   _X_____X,________,
00152   X______X,________,
00153   ______X_,________,
00154   ______X_,________,
00155   _____X__,________,
00156   ____X___,________,
00157   __XX____,________,
00158   ________,________};
00159 
00160 //
00161 // KATAKANA LETTER KO
00162 //
00163 static const unsigned char acFontSJIS13_8352[ 26] = { // Code 8352
00164   ________,________,
00165   ________,________,
00166   __XXXXXX,XX______,
00167   ________,_X______,
00168   ________,_X______,
00169   ________,_X______,
00170   ________,_X______,
00171   ________,_X______,
00172   ________,_X______,
00173   _XXXXXXX,XXXX____,
00174   ________,________,
00175   ________,________,
00176   ________,________};
00177 
00178 static const GUI_CHARINFO GUI_FontSJIS13_CharInfo[6] = {
00179    {   7,   7,  1, acFontSJIS13_0041 } // Code 0041
00180   ,{   7,   7,  1, acFontSJIS13_0042 } // Code 0042
00181   ,{   7,   7,  1, acFontSJIS13_0043 } // Code 0043
00182   ,{  14,  14,  2, acFontSJIS13_8350 } // Code 8350
00183   ,{  14,  14,  2, acFontSJIS13_8351 } // Code 8351
00184   ,{  14,  14,  2, acFontSJIS13_8352 } // Code 8352
00185 };
00186 
00187 static const GUI_FONT_PROP GUI_FontSJIS13_Prop2 = {
00188    0x8350                        // First character
00189   ,0x8352                        // Last character 
00190   ,&GUI_FontSJIS13_CharInfo[  3] // Address of first character
00191   ,0                             // Pointer to next GUI_FONT_PROP
00192 };
00193 
00194 static const GUI_FONT_PROP GUI_FontSJIS13_Prop1 = {
00195    0x0041                        // First character
00196   ,0x0043                        // Last character 
00197   ,&GUI_FontSJIS13_CharInfo[  0] // Address of first character
00198   ,&GUI_FontSJIS13_Prop2 // Pointer to next GUI_FONT_PROP
00199 };
00200 
00201 static const GUI_FONT GUI_FontSJIS13 = {
00202    GUI_FONTTYPE_PROP_SJIS // Type of font   
00203   ,13                     // Height of font 
00204   ,13                     // Space of font y
00205   ,1                      // Magnification x
00206   ,1                      // Magnification y
00207   ,{&GUI_FontSJIS13_Prop1}
00208 };
00209 
00210 /*******************************************************************
00211 *
00212 *  Definition of string containing ASCII and ShiftJIS characters
00213 *
00214 ********************************************************************
00215 */
00216 static const char aSJIS[] = {
00217   "ABC\x83\x50\x83\x51\x83\x52\x0"
00218 };
00219 
00220 /*******************************************************************
00221 *
00222 *        Demonstrates output of ShiftJIS characters
00223 *
00224 ********************************************************************
00225 */
00226 static void _DemoShiftJIS(void) {
00227   GUI_SetFont(&GUI_Font24_ASCII);
00228   GUI_DispStringHCenterAt("FONT_ShiftJIS - Sample", 160, 5);
00229   //
00230   // Set ShiftJIS font
00231   //
00232   GUI_SetFont(&GUI_FontSJIS13);
00233   //
00234   // Display string
00235   //
00236   GUI_DispStringHCenterAt(aSJIS, 160, 80);
00237 }
00238 
00239 /*********************************************************************
00240 *
00241 *       Public code
00242 *
00243 **********************************************************************
00244 */
00245 /*********************************************************************
00246 *
00247 *       MainTask
00248 */
00249 void MainTask(void) {
00250   GUI_Init();
00251   //
00252   // Check if recommended memory for the sample is available
00253   //
00254   if (GUI_ALLOC_GetNumFreeBytes() < RECOMMENDED_MEMORY) {
00255     GUI_ErrorOut("Not enough memory available."); 
00256     return;
00257   }
00258   _DemoShiftJIS();
00259   while (1) {
00260     GUI_Delay(100);
00261   }
00262 }
00263 
00264 /*************************** End of file ****************************/