GSoc Project Proposal
pappu kumar
pappukr4444 at gmail.com
Thu Mar 15 06:40:30 UTC 2018
Pappu Kumar's Student Application for Multicolor Font in LibreOffice1.
Contact Information
• Email address :Pappukr4444 at gmail.com <Pappukr at gmail.com>
• GitHub username : Pappukr4444 <https://github.com/pappukr4444>
• LinkedIn username : Pappu Kumar
<https://www.linkedin.com/in/pappu-kumar-586a56a5/>
• Physical location :
Cluster innovation Centre,
University of Delhi
Delhi- 110007
India
2. Why do you like C++, and why do you want to work on LibreOffice?C++ is a
general-purpose programming language It has imperative, object-oriented and
generic programming features, while also providing facilities for low-level
memory manipulation. C++ is the first language in which i write the hello
world program.I am using the C++ from first year of my graduation it is so
simple and object oriented that why i like this.I am using the libreoffice
for general college purpose work since 2014. I found it is as good as paid
ms Office and it is open source. The we decide to work with the libre
office team and help them to improve the libreoffice software.3. What do
you like about science and why? What area do you like best?My favourite
area is Computer Science and Mathematics, as Mathematics can
single-handedly explain many of the theoretical aspects of research fields
that have a Computer Science background. This is based on the first-hand
experience that I've had with fields such as Software Development, Machine
Learning, Web Development.4. Describe your experience with the following:
C, C++,Java, Android other languages.
• C / C++ : I've worked with both these languages for the last 5 years. I
still use them, as low-level languages. I have already done some college
project in C++ like Attendance management system, File system, Socket
programming, MySQL Compiler.
• Python : I usually try to use Python for machine learning projects
because of there many great libraries that make python very handy for
machine learning.
• HTML/ CSS/ Javascript: Almost all of the Javascript exposure that I have,
is with Web Development. I developed many websites both dynamic and static.
I develop the website using the HTML, CSS, bootstrap and javascript.
• Android/ Java:- Generally I use java for android development. I have
already developed some android app for my college project. The project are
the Chatting App, On This day App, and A payroll Software for Zds pvt. Ltd.
5. Describe your educational background (school, degree plan, major, past
degrees, research area, publications, etc.).
• Majors : 4-year Dual-degree BTech in Information Technology &
mathematical Innovation.
• Minors : Mathematics & Management
I have experience in both Web Development as well as Computer Science
research areas. I'd like to continue with Web Development for any
innovative idea(s), in my future.
6. Please propose a project you would like to work on. Successful proposals
will require advanced planning, communication with the project
administrators and mentors.Support multi coloured font formats tdf#104403
<https://bugs.documentfoundation.org/show_bug.cgi?id=104403> tdf#105488
<https://bugs.documentfoundation.org/show_bug.cgi?id=105488>
The latest version of the OpenType specification introduced few tables that
allow for having multi-colored glyphs, which have many uses the most common
is color Emoji.
The simplest of them is COLR
<https://www.microsoft.com/typography/otspec/colr.htm>/CPAL
<https://www.microsoft.com/typography/otspec/cpal.htm>, which use layers of
normal glyphs and color palettes to assign colors to each.
Another alternative is SVG
<https://www.microsoft.com/typography/otspec/svg.htm> table which embeds
full SVG graphic for each glyph. This one might be a trickier as instead of
rendering layered glyphs with different colors we will need to render SVG
graphics. We already have decent SVG support, but I’m not sure how usable
is it from a low level as text rendering in VCL.
1) Introduction:-
“Support multi coloured font formats”. First of all I want to define the
Multicolored font and some basic terminology that used in the Typography.
Multicolor Font :- The font in which all character has more the one color.
For understanding this project you should have some basic knowledge about
the typography and
-
The understanding of the SFNT structure of OpenType fonts, the different
tables and their work in typography.
-
The basic understanding of How font are stored in the font file and how
the computer understands the font and how the text is rendered on the
computer.
Now I want to introduce some basic terminology that is used in the
typography.
An OpenType font file contains data, in table format, that comprises either
a TrueType or a Compact Font Format (CFF) outline font.The database, with
its various tables, is stored in a file using a format called SFNT, which
stands for “spline font” or “scalable font”.OpenType, TrueType, PostScript
and a few other font types all use the SFNT representation to lay out their
tables into a binary file. But because the SFNT representation is binary -
that is to say, not human readable.
Font - A typical font contains a few letters; it probably also contains
some numbers, and a bunch of symbols, and maybe some other stuff too.
Glyphs - a glyph is a specific design. My glyph for the letter “a” will be
different to your glyph for the letter “a”. “A” and a and a and a are all
different glyphs, but the same character.
Horizontal height - each glyph is how wide it is - not just the black part
of the glyph, but also including the space around it. You will often hear
this referred to as the advance width, or the horizontal advance.
Note:- that the horizontal advance is normally wider than the extremes of
the outlines of the glyph itself:
Kerns - However, to avoid spacing inconsistencies between differing glyph
shapes (particularly between a straightedge and a round) and to make the
type fit more comfortably, the designer of a digital font can specify that
the layout of particular pairs of glyphs should be adjusted.
Baseline - We have mentioned this already, as the imaginary line on which
the glyphs are assembled. In a sense, it’s not really a height - in terms
of a coordinate grid, this is the origin; the y coordinate is zero. This
doesn’t necessarily mean that the “black part” of the glyph starts at the
baseline. Some glyphs, such as this plus sign, have the black parts
floating above the baseline:
OpenType fonts may have the extension .OTF or .TTF, depending on the kind
of outlines in the font and the creators desire for compatibility on
systems without native OpenType support.
In all cases, fonts with only CFF data (no TrueType outlines) always have
an .OTF extension.
Fonts containing TrueType outlines may have either .OTF or .TTF, depending
on the desire for backward compatibility on older systems or with previous
versions of the font.
A font is a database. It’s a related collection of tables and information.
I want to give the name of some table, tag name of that table and and why
to used or what information are present inside that table.
Whether TrueType or CFF outlines are used in an OpenType font, the
following tables are required for the font to function correctly:
Cmap - Character to glyph mapping
Head - Font header
Hhea - Horizontal header
Hmtx - Horizontal metrics
Maxp - Maximum profile
Name - Naming table
OS/2 OS/2 - and Windows specific metrics
Post - PostScript information
Tables related to TrueType outlines
For OpenType fonts based on TrueType outlines, the following tables are
used:
Cvt - Control Value Table (optional table)
Fpgm - Font program (optional table)
Glyf - Glyph data
Loca - Index to location
Prep - CVT Program (optional table)
Gasp - Grid-fitting/Scan-conversion (optional table)
Table related to SVG outlines
SVG - The SVG (Scalable Vector Graphics) table
Advanced typographic tables
Several optional tables support advanced typographic functions:
BASE - Baseline data
GDEF - Glyph definition data
GPOS - Glyph positioning data
GSUB - Glyph substitution data
JSTF - Justification data
MATH - Math layout data
For information on common table formats, please see OpenType Layout Common
Table Formats .
Tables related to color fonts
COLR Color table
CPAL Color palette table
CBDT Color bitmap data
CBLC Color bitmap location data
sbix Standard bitmap graphics
SVG The SVG (Scalable Vector Graphics) table note that several of these
tables were also listed in other sections for tables related to SVG
outlines, and for tables related to bitmap glyphs.
Both CBDT+CBLC and sbix use colored bitmaps (PNGs). FreeType (used in
Android, macOS and iOS) supports CBDT/CBLC and sbix since version 2.5 and
2.5.1. DirectWrite (used in Windows) supports all four above.
In this project, the table that mainly used is the table related to the
colour font.
II) PROJECT GOALS
During this GSoC season I would deliver:
-
The multicoloured font support using the COLR and CPAL table.
-
The multicoloured font support using the SVG table.
-
Making the public API for the COLR and CPAL table so that we can use the
COLR and CPAL table in the LibreOffice.
-
There are many open source project that working on the COLR and CPAL which
use layers of normal glyphs and colour palettes to assign colours to each
like (https://github.com/harfbuzz/harfbuzz).
-
There is no any public library so we can make an API that can use this
open source project.
-
we can use this public API for the multi-coloured text in the
LibreOffice.
III) IMPLEMENTATION
There are two approaches to make LibreOffice support the multicoloured font.
1) Using the COLR and CPAL table:-
The COLR and CPAL are the tables that designed and developed by the
Microsoft. COLR defines one or more accompanying colour glyphs (in vector
format) for each glyph. CPAL defines several colour themes (dark-on-white,
white-on-dark, ...).The main aim of this table is to make the Opentype
support the multi-coloured glyphs.Till now there are only a few open type
font the have the colr and CPAL table in the font file. So The strategy
will be to detect the font that has COLR/CPAL tables and if so, we read
them and render them in the LibreOffice.
For the reading the table data from the font file and rendering them in
LibreOffice. there some open source library available that we can use in
LibreOffice.
1). The First library that we can use is FreeType
https://www.freetype.org/developer.html
FreeType is a freely available software library to render fonts. It is
written in C, designed to be small, efficient, highly customizable, and
portable while capable of producing high-quality output (glyph images) of
most vector and bitmap font formats.
Some products that use FreeType for rendering fonts on screen or on paper,
either exclusively or partially:
GNU/Linux and other free Unix operating system derivatives like FreeBSD or
NetBSD;
iOS, Apple's mobile operating system for iPhones and iPads;
Android, Google's operating system for smartphones and tablet computers;
Chrome OS, Google's operating system for laptop computers;
ReactOS, a free open source operating system based on the best design
principles found in the Windows NT architecture;
Ghostscript, a PostScript interpreter used in many printers.
Counting the above products only, you get more than a billion devices that
contain FreeType.
2) The Second Library that we can use is HarfBuzz
https://github.com/harfbuzz/harfbuzz
HarfBuzz is a text shaping engine. It solves the problem of selecting and
positioning glyphs from a font given a Unicode string. but there is no
public API for harfbuzz yet, so one option is to help to add public API to
HarfBuzz and use it in the LibreOffice.
2) Using the SVG table
The OpenType-SVG font format was initially designed by Mozilla & Adobe and
became an industry standard in early 2016 when other big players including
Microsoft & Google agreed on a single format to support colour fonts.
Today, there are four major colour font formats that fit into regular font
files: SBIX, COLR, CBDT and SVG, each having its own specificities.
The strategy will be to detect the font that has SVG tables and if so, we
read them and render them in the LibreOffice.
For the reading the SVG table data from the font file and rendering them in
LibreOffice. If needed, we can use some open source library.
1). The first library that we can use is SVGPath2Text
<https://github.com/vennekamp/SVGPath2Text>
If a font file has the SVG table then we simply read the data and the SVG
path of different font and we can render them using the SvgPath2Text open
source library. <https://github.com/vennekamp/SVGPath2Text>
SVGPath2Text <https://github.com/vennekamp/SVGPath2Text> A brute force tool
to convert SVG Outlines (aka SVG Path; SVG Glyphs) back to the text.
Helpful if you need smaller file sizes.
https://github.com/vennekamp/SVGPath2Text
A brute force tool to convert SVG Outlines (aka SVG Path; SVG Glyphs) back
to the text. Helpful if you need smaller file sizes.
A Demo-SVG-File is included. This Tool maps the Glyphs (i.e. SVG Paths)
from a template to the elements found in an SVG File.
This is just a dirty hack ;-) It currently only works for the font "Comic
Sans MS" in file size 7px; Most of the letters in the demo file are found
correctly, but placement still needs improvement. To alter this work you
need to change the "template letters" to your font and font size.
2) The Second Library that we can use for SVG Rendering is SVG Renderer
-
SVG Renderer library in C++
-
full gradient support
-
group opacity
-
all shapes support
-
all path elements support
-
render to memory
-
gaussian blur effect support
svgren uses svgdom <https://github.com/igagis/svgdom> to read the SVG file
and cairo <http://cairographics.org/> to render graphics.
The below code give an overview of how we can we the SVGREN for the svg
rendering.
Please note, that svgren uses C++'11 features, like auto etc.
First of all we need to include the svgren header file
#include <svgren/render.hpp>
#include <papki/FSFile.hpp> //we will need this to load the SVG file
Then we need to load the SVG file and create the document object model
(DOM), let's load the file called camera.svg
auto dom = svgdom::load(papki::FSFile("camera.svg"));
Then we just render the SVG into a memory buffer
unsigned width = 0; //0 means use width from SVG document
unsigned height = 0; //0 means use height from SVG document
auto img = svgren::render(*dom, width, height); //uses 96 dpi by default
//At this point the 'width' and 'height' variables were filled with
//the actual width and height of the rendered image.
//Returned 'img' is a std::vector<std::uint32_t> holding array of RGBA
values.
If SVG document specifies any coordinates or lengths in physical units,
like millimeters or centimeters or inches, we have to supply the dots per
inch (DPI) value of our physical display to the svgren::render() function
unsigned width = 0; //0 means use width from SVG document
unsigned height = 0; //0 means use height from SVG document
auto img = svgren::render(*dom, width, height, 240); //240 dpi
After that one can use the rendered image data to display it on any
physical display or whatever.
7. Please provide a specific timeline for your project.
Phase I - April 23rd to May 14th (Community Bonding Period)
This will be the phase where I get to know more about fellow student
developers and mentors. This period will involve more discussions regarding
the following -
-
The architecture of the overall project.
-
what is the workflow?
-
Getting more about the fellow student developers and mentors.
-
More discussion about the library and frameworks that we are going to
use for our project.
It shouldn't take such a long span of 20 days for a consensus to be
reached. However, I've provided a buffer - just in case it takes time for a
consensus to be reached. In case a common consensus is achieved before May
10th, I'll start coding for the next phase.
Phase II - May 14th to June 15th (Support COLR/CPAL Multicolored font)
This is the phase where the support of COLR/CPAL Multicolored Font has been
done.
During this phase, I intend to complete the code for support of COLR/CPAL
Multicolored font, along with this testing and documentation also be done.
The first step towards this is to read the binary font file and find out
whether COLR/CPAL table is present or not. If present then read the font
file and render them into the LibreOffice.
The period of June 10th - June 15th will also provide some time to have any
pending discussions regarding exporters / view-helpers.
-
*Deliverables of Phase II -*
1.
Support Multi Colored font with COLR and CPAL Table.
2.
Making some public API for using some library in LibreOffice, if needed.
Phase III - June 16th to July 13th (Support SVG Multicolored font)
This is the phase where I work for the support of SVG Multicolored Font has
been done.
During this phase, I intend to complete the code for support of SVG
Multicolored font, along with this testing and documentation also be done.
The first step towards this is to read the binary font file and find out
whether SVG table is present or not. If present then read the font file and
render them into the LibreOffice.
The period of 4-5 days will also provide some time to have any pending
discussions regarding Support of the SVG Multi Colored font in the
LibreOffice.
-
Deliverables of Phase III -
1.
Support Multi Colored font with COLR and CPAL Table.
2.
Making some public API for using some library in LibreOffice, if needed.
Phase IV - July 14th to August 6th (Presentation)
Finally, a sample Multicolored font support showcasing the usage of the
robust deliverables of Multicolored font support with LibreOffice will be
required to help the users with getting started quickly. This should be
done by last August (including a day of buffer), without documentation of
the LibreOffice.
As of the final phase of submissions that are from August 21st - August
29th, Multicolored Font Support should be deliverable, with a sample
Example (with/without documentation) showcasing the use of the Multicolored
font in the LibreOffice.
-
Deliverables of Phase IV -
1.
Integration of the Multicolored support in the LibreOffice.
2.
Final Documentation.
3.
Multicoloured Font Support showcasing.
--
Thanks and Regards,
--
*Pappu Kumar*
*B.Tech (IT & Mathematical innovations)*
*Cluster Innovation Centre*
*University of Delhi*
*Mob no.-7533093834, 9971083757*
<https://mailtrack.io/> Sent with Mailtrack
<https://mailtrack.io?utm_source=gmail&utm_medium=signature&utm_campaign=signaturevirality&>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice/attachments/20180315/e9b21175/attachment-0001.html>
More information about the LibreOffice
mailing list