File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed
Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -327,6 +327,28 @@ mod shim {
327327 }
328328 }
329329
330+ /// Test implementation of microtex_get_key_char_metrics.
331+ ///
332+ /// Returns the buffer configured via test_control::set_buffer, which should
333+ /// contain JSON with key character metrics data.
334+ pub unsafe fn microtex_get_key_char_metrics (
335+ _render_ptr : * mut c_void ,
336+ out_len : & mut u64 ,
337+ ) -> * mut u8 {
338+ if crate :: test_control:: get_return_empty ( ) {
339+ * out_len = 0 ;
340+ std:: ptr:: null_mut ( )
341+ } else {
342+ let ( ptr, len) = crate :: test_control:: get_out_buffer_ptr ( ) ;
343+ * out_len = len;
344+ if len == 0 || ptr. is_null ( ) {
345+ std:: ptr:: null_mut ( )
346+ } else {
347+ ptr as * mut u8
348+ }
349+ }
350+ }
351+
330352 pub unsafe fn microtex_delete_render ( _ptr : * mut c_void ) {
331353 // noop
332354 }
@@ -419,6 +441,16 @@ mod shim {
419441 test_impl:: microtex_render_to_svg_with_metrics ( render_ptr, out_len)
420442 }
421443 #[ cfg( test) ]
444+ /// Test wrapper for microtex_get_key_char_metrics.
445+ ///
446+ /// Delegates to the test_impl implementation which uses test_control::get_out_buffer_ptr().
447+ pub unsafe fn microtex_get_key_char_metrics (
448+ render_ptr : * mut c_void ,
449+ out_len : & mut u64 ,
450+ ) -> * mut u8 {
451+ test_impl:: microtex_get_key_char_metrics ( render_ptr, out_len)
452+ }
453+ #[ cfg( test) ]
422454 pub unsafe fn microtex_delete_render ( render_ptr : * mut c_void ) {
423455 test_impl:: microtex_delete_render ( render_ptr)
424456 }
You can’t perform that action at this time.
0 commit comments