dRonin  adbada4
dRonin firmware
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
encode_fonts Namespace Reference

Functions

def grouper
 
def encode_font
 
def c_format_font
 

Variables

tuple file_header = Template("""/** ****************************************************************************** * @file $FILENAME * @author dRonin, http://dRonin.org/, Copyright (C) 2016 * @author The OpenPilot Team, http://www.openpilot.org, Copyright (C) 2012 * @author Thomas Oldbury Copyright (C) 2010 * @addtogroup dRonin Modules * @{ * @addtogroup OnScreenDisplay Module * @{ * @brief Fonts for OSD *****************************************************************************//* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, see <http://www.gnu.org/licenses/> * * Additional note on redistribution: The copyright and license notices above * must be maintained in each individual source file that is a derivative work * of this source file; otherwise redistribution is prohibited. * * NOTE: This file is generated by encode_fonts.py DO NOT EDIT! * NOTE: Some fonts are CC 3.0 BY-SA and note GPL licensed. See FONT_LICENSE.txt */""")
 
tuple font_header_template = Template("""#ifndef FONTS_H#define FONTS_H#include <openpilot.h>struct FontEntry {\tuint8_t width;\tuint8_t height;\tconst uint8_t* lookup;\tconst uint16_t* data;};#define NUM_FONTS $NUM_FONTS$names#endif /* FONTS_H */""")
 
tuple font_c_template = Template("""static const struct FontEntry font_$name = {\t.width = $width,\t.height = $height,\t.lookup = lookup_$name,\t.data = (uint16_t*)data_$name};""")
 
tuple font_c_table = Template("""const struct FontEntry* fonts[NUM_FONTS] = {$CONTENT};""")
 
tuple parser = OptionParser()
 
string help = 'Output file'
 
string type = "int"
 
 in_files = args
 
list names = [fname[:-4] for fname in in_files]
 
tuple fonts = dict()
 
tuple n_fonts = len(fonts)
 
string font_name_str = ''
 
list font = fonts[name]
 
list height = font['height']
 
string content = ''
 

Function Documentation

def encode_fonts.c_format_font (   fid,
  name,
  font,
  buffer_names,
  buffers,
  row_width = 16 
)
Format image as a C header

Definition at line 189 of file encode_fonts.py.

def encode_fonts.encode_font (   fname,
  start,
  last 
)

Definition at line 124 of file encode_fonts.py.

def encode_fonts.grouper (   n,
  iterable,
  padvalue = None 
)

Definition at line 119 of file encode_fonts.py.

Variable Documentation

list encode_fonts.content = ''

Definition at line 274 of file encode_fonts.py.

tuple encode_fonts.file_header = Template("""/** ****************************************************************************** * @file $FILENAME * @author dRonin, http://dRonin.org/, Copyright (C) 2016 * @author The OpenPilot Team, http://www.openpilot.org, Copyright (C) 2012 * @author Thomas Oldbury Copyright (C) 2010 * @addtogroup dRonin Modules * @{ * @addtogroup OnScreenDisplay Module * @{ * @brief Fonts for OSD *****************************************************************************//* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, see <http://www.gnu.org/licenses/> * * Additional note on redistribution: The copyright and license notices above * must be maintained in each individual source file that is a derivative work * of this source file; otherwise redistribution is prohibited. * * NOTE: This file is generated by encode_fonts.py DO NOT EDIT! * NOTE: Some fonts are CC 3.0 BY-SA and note GPL licensed. See FONT_LICENSE.txt */""")

Definition at line 43 of file encode_fonts.py.

list encode_fonts.font = fonts[name]

Definition at line 258 of file encode_fonts.py.

tuple encode_fonts.font_c_table = Template("""const struct FontEntry* fonts[NUM_FONTS] = {$CONTENT};""")

Definition at line 114 of file encode_fonts.py.

tuple encode_fonts.font_c_template = Template("""static const struct FontEntry font_$name = {\t.width = $width,\t.height = $height,\t.lookup = lookup_$name,\t.data = (uint16_t*)data_$name};""")

Definition at line 103 of file encode_fonts.py.

tuple encode_fonts.font_header_template = Template("""#ifndef FONTS_H#define FONTS_H#include <openpilot.h>struct FontEntry {\tuint8_t width;\tuint8_t height;\tconst uint8_t* lookup;\tconst uint16_t* data;};#define NUM_FONTS $NUM_FONTS$names#endif /* FONTS_H */""")

Definition at line 82 of file encode_fonts.py.

string encode_fonts.font_name_str = ''

Definition at line 246 of file encode_fonts.py.

list encode_fonts.height = font['height']

Definition at line 272 of file encode_fonts.py.

string encode_fonts.help = 'Output file'

Definition at line 225 of file encode_fonts.py.

encode_fonts.in_files = args

Definition at line 237 of file encode_fonts.py.

tuple encode_fonts.n_fonts = len(fonts)

Definition at line 244 of file encode_fonts.py.

list encode_fonts.names = [fname[:-4] for fname in in_files]

Definition at line 238 of file encode_fonts.py.

tuple encode_fonts.parser = OptionParser()

Definition at line 223 of file encode_fonts.py.

string encode_fonts.type = "int"

Definition at line 230 of file encode_fonts.py.