Skip to content

Commit

Permalink
Use R13B02 to speed up building of fonts
Browse files Browse the repository at this point in the history
Using the new file:read_file/1 function we can speed up building
of fonts.

NOTE: For developers: Erlang/OTP R13B02 is now required for building
Wings. [bjorng]
  • Loading branch information
bjorng committed Oct 17, 2009
1 parent 5734ad5 commit beb0a35
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
2 changes: 1 addition & 1 deletion BUILD.unix
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ run all plug-ins and to build an installation package.

- The Wings source files. http://www.wings3d.com

- Erlang/OTP R13B01 or later. http://www.erlang.org
- Erlang/OTP R13B02 or later. http://www.erlang.org

- SDL development library. http://www.libsdl.org.
(There are pre-built libraries for most platforms.)
Expand Down
2 changes: 1 addition & 1 deletion BUILD.win32
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ The following software is needed:
http://www.mingw.org/wiki/msys, for development work, but we have
not tested to package an release using MSYS.)

- Erlang/OTP R13B01 or later. http://www.erlang.org
- Erlang/OTP R13B02 or later. http://www.erlang.org
(It is easiest to download the pre-built binaries for Windows.)

- ESDL 1.0.1 or later. http://esdl.sf.net
Expand Down
18 changes: 12 additions & 6 deletions fonts_src/bdf2wingsfont.erl
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ convert([Out|SrcFonts]) ->

read_fonts([N|Ns], Acc) ->
io:format("Reading ~s\n", [N]),
{ok,F} = file:open(N, [binary,read,read_ahead]),
{ok,F} = file:open(N, [binary,read,read_ahead,raw]),
G = read_font(F),
file:close(F),
read_fonts(Ns, G++Acc);
Expand Down Expand Up @@ -63,7 +63,7 @@ read_props_1(F, N, Acc) ->
read_props_1(F, N-1, [P|Acc]).

read_one_prop(F) ->
read_one_prop_1(io:get_line(F, ''), []).
read_one_prop_1(raw_read_line(F), []).

read_one_prop_1(<<C,Cs/bytes>>, Key) when C =< $\s ->
read_one_prop_2(Cs, reverse(Key));
Expand Down Expand Up @@ -143,7 +143,7 @@ read_one_glyph_1(F, G) ->
end.

read_bitmap(F, Acc) ->
case io:get_line(F, '') of
case raw_read_line(F) of
<<"ENDCHAR",_/bytes>> ->
list_to_binary(Acc);
<<H1,H2,_/bytes>> ->
Expand Down Expand Up @@ -188,7 +188,7 @@ filter_unicode(Gs) ->


read_map(MapName) ->
{ok,F} = file:open(MapName, [binary,read,read_ahead]),
{ok,F} = file:open(MapName, [binary,read,read_ahead,raw]),
Map = read_map_1(F, []),
file:close(F),
Map.
Expand All @@ -207,14 +207,14 @@ error(Term) ->
throw({error,Term}).

read_map_line(F) ->
case skip_whitespace(io:get_line(F, '')) of
case skip_whitespace(raw_read_line(F)) of
eof -> eof;
<<$#,_/bytes>> -> read_map_line(F);
Cs -> collect_tokens(Cs)
end.

read_line(F) ->
case read_line_1(io:get_line(F, ''), F) of
case read_line_1(raw_read_line(F), F) of
["COMMENT"|_] -> read_line(F);
Line -> Line
end.
Expand Down Expand Up @@ -250,6 +250,12 @@ skip_whitespace([C|Cs]) when C =< $\s ->
skip_whitespace(Cs);
skip_whitespace(Cs) -> Cs.

raw_read_line(F) ->
case file:read_line(F) of
eof -> eof;
{ok,Line} -> Line
end.

%%%
%%% Writing the font.
%%%
Expand Down

0 comments on commit beb0a35

Please sign in to comment.