{"id":23056,"library":"cu2qu","title":"cu2qu","description":"cu2qu is a Python library for converting cubic bezier curves to quadratic bezier curves, commonly used in font engineering workflows such as converting cubic outlines (TrueType) to quadratic outlines (OpenType). Current version 1.6.7.post2 is in maintenance mode, with infrequent updates.","status":"maintenance","version":"1.6.7.post2","language":"python","source_language":"en","source_url":"https://github.com/googlefonts/cu2qu","tags":["font","bezier","cubic-to-quadratic","fonttools"],"install":[{"cmd":"pip install cu2qu","lang":"bash","label":"latest from PyPI"}],"dependencies":[],"imports":[{"note":"The library provides pens, not direct functions. Import the pen class for conversion.","wrong":"import cu2qu","symbol":"curve_to_quadratic","correct":"from cu2qu.pens import CurveToQuadraticPen"},{"note":"This function is available at the top-level cu2qu module.","wrong":"","symbol":"cubic_approx_quadratic","correct":"from cu2qu import cubic_approx_quadratic"}],"quickstart":{"code":"from cu2qu.pens import CurveToQuadraticPen\nfrom fonttools.pens.recordingPen import RecordingPen\n\n# Example: convert a cubic path to quadratic\nrecorder = RecordingPen()\n# Assume you have a cubic path to draw\n# For demonstration, we create a dummy converter\npen = CurveToQuadraticPen(recorder, max_err=1.0)\npen.moveTo((0, 0))\npen.lineTo((100, 0))\npen.curveTo((50, 150), (150, 150), (100, 0))\npen.closePath()\nprint('Conversion done. Check recorder for output.')","lang":"python","description":"Demonstrates using CurveToQuadraticPen to convert a cubic bezier curve to quadratic. Requires a target pen (here RecordingPen from fonttools) to record the output."},"warnings":[{"fix":"Ensure fonttools is installed and use pens like fonttools.pens.recordingPen.RecordingPen to capture output.","message":"cu2qu functions are primarily designed for use with fonttools pens. Direct usage without fonttools may require additional adaptation.","severity":"gotcha","affected_versions":"all"},{"fix":"Migrate to fonttools' own quadratic conversion tools or use the pens module directly.","message":"The 'cu2qu.ufo' module is deprecated and may be removed in future versions. Use fonttools instead.","severity":"deprecated","affected_versions":">=1.6.0"},{"fix":"Pin to cu2qu==1.6.7 if post-release causes issues.","message":"Version 1.6.7.post2 is a post-release; it may not be the final stable release. Check for newer stable versions or rely on 1.6.7.","severity":"gotcha","affected_versions":"1.6.7.post2"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run 'pip install cu2qu' to install the library.","cause":"cu2qu is not installed.","error":"ModuleNotFoundError: No module named 'cu2qu'"},{"fix":"Use 'from cu2qu.pens import CurveToQuadraticPen' instead.","cause":"The function is not exposed at the top level; it's inside pens submodule.","error":"AttributeError: module 'cu2qu' has no attribute 'curve_to_quadratic'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}