Closed Bug 190760 Opened 22 years ago Closed 20 years ago

SVG text support using libart

Categories

(Core :: SVG, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: leon.sha, Assigned: leon.sha)

References

Details

Attachments

(1 file, 1 obsolete file)

User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.3a) Gecko/20021212
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.3a) Gecko/20021212

It is just a patch for basic text support.

There are some other things should be done before build:
1. Modify Makefile of libart_lgpl. Add art_render_mask.h .c into it.
2. Enable freetype(see below).
3. I suggest copy windows truetye font to your font directory.

Freetype support in mozilla.

When configure, mozilla will detect whether system has freetype2
library, if yes, mozilla's freetype code will be compiled in; if not,
mozilla won't support freetype whether you set pref "true" or
"false"(see below).
In user's peferencce(dist/bin/default/prefs/unix.js), the freetype pref
(line 235) is default disabled; if you want to use freetype, you just
change that line to "pref("font.FreeType2.enable",  true)" and add your
TrueType font dir (line 247-249).  All these thing work only if your
mozilla has freetype2 compiled in.


Reproducible: Always

Steps to Reproduce:
1.
2.
3.
Attached patch SVG text support using libart (obsolete) — Splinter Review
Depends on: svgbranch
Reassigning to leon because he's the author 
Assignee: alex.fritze → leon.sha
Status: UNCONFIRMED → NEW
Ever confirmed: true
I took a 'real' patch against SVG_20020806_BRANCH with a few minor changes:
 
- layout/svg/renderer/src/Makefile(.in): moved up 
'include $(topsrcdir)/config/config.mk' so that $(FT2_LIBS) is resolved ok.
- removed myself & crocodile clips from credits (leon.sha@sun.com is original
author)
- untabified all files

To install the patch, cd into layout/svg/renderer/src/libart/ and do 
'patch <the_patch'.
Attachment #112726 - Attachment is obsolete: true
>- removed myself & crocodile clips from credits (leon.sha@sun.com is original
>author)

well, but you should still fill in an original author... the patch seems to make
that "The original author is."

Also... would it be easy to support Xft instead of Freetype2 for those who
compile with --enable-xft? it would be nice if so, because Xft requires no
additional font setup for mozilla.
I don't believe any of the font config you suggested is needed if you build
Mozilla with GTK2 instead of GTK1. In this case, freetype2 is always enabled via
a shared library and fontconfig is automatic via /etc/fonts/font.conf.

GTK is pretty dang stable these days. I've only seen problems with pixmap-based
GTK2 themes getting some wierd colors.
Requiring GTK2 sounds like a good idea if it simplifies the configuration. We
require GTK2 for other areas of the SVG code anyway. 

Leon: If it's ok with you, I'd like to merge this patch into the branch now.
Have you got any updated code that is not contained in the patch?
I've tried applying patch 112729 to my mac build.
It doesn't work because the underlying source has changed too much.

-------------
chunk 2 in the patach fails and had to be modified by hand to :

include $(topsrcdir)/config/config.mk

#ifdef MOZ_ENABLE_FREETYPE2
DEFINES         += -DMOZ_ENABLE_FREETYPE2
INCLUDES        += $(FT2_CFLAGS)
EXTRA_DSO_LDOPTS += $(LIBS_DIR) -lgfxft2
# due to runtime linking with PR_LoadLibrary
# EXTRA_DSO_LDOPTS does not need $(FT2_LIBS)
#endif

# we don't want the shared lib, but we want to force the creation of a static lib.
FORCE_STATIC_LIB = 1

# choose a toolkit specific implementation of nsISVGLibartBitmap:

# gtk2:
ifeq ($(MOZ_GFX_TOOLKIT),gtk2)
CPPSRCS  += nsSVGLibartBitmapGdk.cpp
CFLAGS   += $(MOZ_GTK2_CFLAGS)
CXXFLAGS += $(MOZ_GTK2_CFLAGS)

LOCAL_INCLUDES	= \
		-I$(topsrcdir)/gfx/src/gtk \
		-I$(topsrcdir)/gfx/src \
                -I$(topsrcdir)/gfx/src/freetype \
		$(NULL)
endif

-------
in /mozilla/layout/svg/renderer/src/libart/libart-incs.h
make complains about line 62:
#include "art_render_mask.h"
with the file being non-existent

-------
finally, the build fails beyond my abilities to repair with:
In file included from nsSVGLibartGlyphGeometry.cpp:49:
nsISVGLibartGlyphMetrics.h:43:24: nsFreeType.h: No such file or directory
In file included from nsSVGLibartGlyphGeometry.cpp:49:

...

make[5]: *** [nsSVGLibartGlyphGeometry.o] Error 1
make[4]: *** [libs] Error 2

...
An enhanced version of Leon's patch is now checked in on SVG_20020806_BRANCH.
It will build automatically for freetype-enabled builds, but before any text can
be rendered, Mozilla/freetype needs to be configured according to the
instructions on
http://www.mozilla.org/projects/fonts/unix/enabling_truetype.html (steps 2-7).

Things working:
- basic filled text
- transformations

Things not working yet:
- stroking
- underlining/strikethrough
- dynamic updating
- getExtentOfChar()
I've tried to get the latest patch to work under Mac OS X

1) installed freetype2
2) inserted :
pref("font.FreeType2.enable", true);
pref("font.directory.truetype.1", "/Library/Fonts");
pref("font.freetype2.shared-library", "libfreetype.6.dylib");
- into Mozilla.app/Contents/MacOS/defaults/pref/macprefs.js

text doesn't show on the croc testcases :-(
What is suggested for fixing this in Firebird builds?

I can't checkout SVG_20020806_BRANCH and FIREBIRD_0_6_1_RELEASE at the
same time.
Apologies, commented wrong bug.
With the landing of the SVG development branch we now have basic libart/freetype
text -> Marking fixed.
Status: NEW → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: