9front - general discussion about 9front
 help / color / mirror / Atom feed
From: kokamoto@hera.eonet.ne.jp
To: 9front@9front.org
Subject: Re: [9front] [ports] add libfreetype
Date: Thu, 26 Mar 2020 14:26:43 +0900	[thread overview]
Message-ID: <6C4D5687E7FF32423616B0CFA3CE6379@hera.eonet.ne.jp> (raw)
In-Reply-To: CAF=5iUWe52fo+UV+Yf1YresHphBNe4Lv29up0_0g0QsfcaahgA@mail.gmail.com

[-- Attachment #1: Type: text/plain, Size: 3841 bytes --]

Thank you very much Lucas!

Attached is a new netsurf webpage image using dejavu freetpe font.
Most peoples here don't have interest to Japanese font, I show dejavu font example.

Main changes are frontends/framebuffer/font_freetype.c and netsurf/mkfile, and of course
put dejavu font files under /sys/lib/netsurf/fonts/truetype/dejavu.

The font defines in mkfile didn't work, so I hard coded each font names in
font_freetype.c.☺

mkfile:
OBJ=\
...
#	frontends/framebuffer/font_internal.$O \
#	frontends/framebuffer/font-ns-sans.$O \
	frontends/framebuffer/font_freetype.$O \
...
CFLAGS=\
...
	-DNETSURF_FB_FONTPATH="/sys/lib/netsurf/fonts/truetype/dejavu" \
...
	-DFB_USE_FREETYPE \
#	-DNETSURF_FB_FONT_SANS_SERIF =const char *"DejaVuSans.ttf\" \
#	-DNETSURF_FB_FONT_SANS_SERIF_BOLD =const char *"DejaVuSans-Bold.ttf" \
#	-DNETSURF_FB_FONT_SANS_SERIF_ITALIC =const char *"DejaVuSans-Oblique.ttf\" \
#	-DNETSURF_FB_FONT_SANS_SERIF_ITALIC_BOLD =const char *"DejaVuSans-BoldOblique.ttf" \
#	-DNETSURF_FB_FONT_SERIF =const char *"DejaVuSerif.ttf" \
#	-DNETSURF_FB_FONT_SERIF_BOLD =const char *"DejaVuSerif-Bold.ttf" \
#	-DNETSURF_FB_FONT_MONOSPACE =const char *"DejaVuSansMono.ttf" \
#	-DNETSURF_FB_FONT_MONOSPACE_BOLD =const char *"DejaVuSansMono-Bold.ttf" \
#	-DNETSURF_FB_FONT_CURSIVE =const char *"Comic_Sans_MS.ttf" \
#	-DNETSURF_FB_FONT_FANTASY =const char *"Impact.ttf"

font_freetype.c:
...
/* exported interface documented in framebuffer/font.h */
bool fb_font_init(void)
{
...
	/* Start with the sans serif font */
	fb_face = fb_new_face(nsoption_charp(fb_face_sans_serif),
			      "sans_serif.ttf",
//			      NETSURF_FB_FONT_SANS_SERIF);
			     "DejaVuSans.ttf");		/* K.Okamoto */
...
	/* Bold sans serif face */
	fb_face = fb_new_face(nsoption_charp(fb_face_sans_serif_bold),
                            "sans_serif_bold.ttf",
//                            NETSURF_FB_FONT_SANS_SERIF_BOLD);
			  "DejaVuSans-Bold.ttf");		/* K.Okamoto */
...
	/* Italic sans serif face */
	fb_face = fb_new_face(nsoption_charp(fb_face_sans_serif_italic),
			      "sans_serif_italic.ttf",
//			      NETSURF_FB_FONT_SANS_SERIF_ITALIC);
	   		     "DejaVuSans-Oblique.ttf");		/* K.Okamoto */
...
	/* Bold italic sans serif face */
	fb_face = fb_new_face(nsoption_charp(fb_face_sans_serif_italic_bold), 
			      "sans_serif_italic_bold.ttf",
//			      NETSURF_FB_FONT_SANS_SERIF_ITALIC_BOLD);
			     "DejaVuSans-BoldOblique.ttf");		/* K.Okamoto */
...
	/* serif face */
	fb_face = fb_new_face(nsoption_charp(fb_face_serif),
                            "serif.ttf",
//			      NETSURF_FB_FONT_SERIF);
			  "DejaVuSerif.ttf");		/* K.Okamoto */
...
	/* bold serif face*/
	fb_face = fb_new_face(nsoption_charp(fb_face_serif_bold),
			      "serif_bold.ttf",
//			      NETSURF_FB_FONT_SERIF_BOLD);
			      "DejaVuSerif-Bold.ttf");		/* K.Okamoto */
...
	/* monospace face */
	fb_face = fb_new_face(nsoption_charp(fb_face_monospace),
			      "monospace.ttf",
//			      NETSURF_FB_FONT_MONOSPACE);
			      "DejaVuSansMono.ttf");		/* K.Okamoto */
...
	/* bold monospace face*/
	fb_face = fb_new_face(nsoption_charp(fb_face_monospace_bold),
			      "monospace_bold.ttf",
//			      NETSURF_FB_FONT_MONOSPACE_BOLD);
			      "DejaVuSansMono-Bold.ttf");		/* K.Okamoto */
...
	/* cursive face */
	fb_face = fb_new_face(nsoption_charp(fb_face_cursive),
			      "cursive.ttf",
//			      NETSURF_FB_FONT_CURSIVE);
			      "Comic_Sans_MS.ttf");		/* K.Okamoto */
...
	fb_face = fb_new_face(nsoption_charp(fb_face_fantasy),
			      "fantasy.ttf",
//			      NETSURF_FB_FONT_FANTASY);
			     "Impact.ttf");		/* K.Okamoto */
...

Kenji

PS: 
please include two lines in ft2build.h like:
#ifndef FT2BUILD_H_
#define FT2BUILD_H_

#pragma	src	"/sys/ports/ape-libs/libfreetype"
#pragma	lib	"/$M/lib/ape/libfreetype.a"

#include <freetype/config/ftheader.h>

[-- Attachment #2: netsurf.bit --]
[-- Type: image/p9bit, Size: 467464 bytes --]

             reply	other threads:[~2020-03-26  5:26 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-26  5:26 kokamoto [this message]
2020-03-26 22:10 ` Lucas Francesco
  -- strict thread matches above, loose matches on Subject: below --
2020-03-28  5:28 kokamoto
2020-03-26 23:17 kokamoto
2020-03-26  5:53 kokamoto
2020-03-25  5:55 Lucas Francesco
2020-03-26 23:43 ` [9front] " ori

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6C4D5687E7FF32423616B0CFA3CE6379@hera.eonet.ne.jp \
    --to=kokamoto@hera.eonet.ne.jp \
    --cc=9front@9front.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).