11const std = @import ("std" );
2- const reader = @import ("./byte_read.zig" );
3- const mod = @import ("./parser.zig" );
2+ const reader = @import (".. /byte_read.zig" );
3+ const mod = @import (".. /parser.zig" );
44const Allocator = std .mem .Allocator ;
5- const Head = @import ("./table/head.zig" );
6- const byte_writer = @import ("./byte_writer.zig" );
5+ const Head = @import (".. /table/head.zig" );
6+ const byte_writer = @import (".. /byte_writer.zig" );
77
88const zlib = std .compress .zlib ;
99const fs = std .fs ;
@@ -18,7 +18,7 @@ pub const Woff = struct {
1818
1919 allocator : Allocator ,
2020 parser : * Parser ,
21- compressor : * const fn (data : []const u8 , allocator : Allocator ) anyerror ! []u8 ,
21+ compressor : * const fn (allocator : Allocator , data : []const u8 ) anyerror ! []u8 ,
2222
2323 pub const Error = error {
2424 InvalidSfntVersion ,
@@ -36,7 +36,7 @@ pub const Woff = struct {
3636 pub fn init (
3737 allocator : Allocator ,
3838 parser : * Parser ,
39- compressor : * const fn (data : []const u8 , allocator : Allocator ) anyerror ! []u8 ,
39+ compressor : * const fn (allocator : Allocator , data : []const u8 ) anyerror ! []u8 ,
4040 ) Self {
4141 return Self {
4242 .allocator = allocator ,
@@ -74,7 +74,7 @@ pub const Woff = struct {
7474 const start = table_record .offset ;
7575 const end = start + table_record .length ;
7676 const table_data = self .parser .buffer [start .. end ];
77- const compressed_data = try self .compressor (table_data , self .allocator );
77+ const compressed_data = try self .compressor (self .allocator , table_data );
7878
7979 const use_compressed = compressed_data .len < table_data .len ;
8080 const final_data = if (use_compressed ) compressed_data else table_data ;
@@ -162,7 +162,7 @@ pub const Woff = struct {
162162pub fn ttf_to_woff_v1 (
163163 allocator : Allocator ,
164164 data : []u8 ,
165- compressor : * const fn (data : []const u8 , allocator : Allocator ) anyerror ! []u8 ,
165+ compressor : * const fn (allocator : Allocator , data : []const u8 ) anyerror ! []u8 ,
166166) ! []u8 {
167167 var parser = try Parser .init (allocator , data );
168168 defer parser .deinit ();
@@ -174,14 +174,14 @@ pub fn ttf_to_woff_v1(
174174pub fn ttf_woff_v1_with_parser (
175175 allocator : Allocator ,
176176 parser : * Parser ,
177- compressor : * const fn (data : []const u8 , allocator : Allocator ) anyerror ! []u8 ,
177+ compressor : * const fn (allocator : Allocator , data : []const u8 ) anyerror ! []u8 ,
178178) ! []u8 {
179179 var woff = Woff .init (allocator , parser , compressor );
180180 return woff .as_woff ();
181181}
182182
183183// Mock compressor for testing purposes
184- fn mock_compressor (data : []const u8 , allocator : Allocator ) ! []u8 {
184+ fn mock_compressor (allocator : Allocator , data : []const u8 ) ! []u8 {
185185 var compressed_data = std .ArrayList (u8 ).init (allocator );
186186 defer compressed_data .deinit ();
187187
0 commit comments