# -*- coding: utf-8 -*- from reportlab.lib.pagesizes import letter from reportlab.lib.units import inch from reportlab.pdfgen import canvas from reportlab.pdfbase import pdfmetrics from reportlab.pdfbase.ttfonts import TTFont # Register DejaVu fonts (full Unicode/Romanian support) pdfmetrics.registerFont(TTFont('DejaVu', '/nix/store/r95kfq61dvrqvrqwqyrnm057bxv9ykzr-dejavu-fonts-2.37/share/fonts/truetype/DejaVuSans.ttf')) pdfmetrics.registerFont(TTFont('DejaVuBold', '/nix/store/r95kfq61dvrqvrqwqyrnm057bxv9ykzr-dejavu-fonts-2.37/share/fonts/truetype/DejaVuSans-Bold.ttf')) pdfmetrics.registerFont(TTFont('DejaVuOblique', '/nix/store/r95kfq61dvrqvrqwqyrnm057bxv9ykzr-dejavu-fonts-2.37/share/fonts/truetype/DejaVuSansCondensed-Oblique.ttf')) outpath = '/home/ben/ava/ben/kitchen/meal-structure-cheatsheet.pdf' c = canvas.Canvas(outpath, pagesize=letter) W, H = letter margin = 0.6 * inch # Helper functions def draw_title(c, y, text, size=16): c.setFont('DejaVuBold', size) c.drawCentredString(W/2, y, text) return y - size - 4 def draw_heading(c, x, y, text, size=10): c.setFont('DejaVuBold', size) c.drawString(x, y, text) return y - size - 3 def draw_text(c, x, y, text, size=8, font='DejaVu', indent=0): c.setFont(font, size) c.drawString(x + indent, y, text) return y - size - 2 def draw_bullet(c, x, y, text, size=7.5, indent=8): c.setFont('DejaVu', size) c.drawString(x, y, '\u2022') # Word wrap if needed max_width = W - margin - x - indent - 10 words = text.split() lines = [] current = '' for w in words: test = current + ' ' + w if current else w if pdfmetrics.stringWidth(test, 'DejaVu', size) < max_width: current = test else: lines.append(current) current = w if current: lines.append(current) for i, line in enumerate(lines): c.drawString(x + indent, y - i * (size + 1.5), line) return y - len(lines) * (size + 1.5) - 1 def draw_bold_bullet(c, x, y, bold_part, rest, size=7.5, indent=8): c.setFont('DejaVu', size) c.drawString(x, y, '\u2022') c.setFont('DejaVuBold', size) c.drawString(x + indent, y, bold_part) bw = pdfmetrics.stringWidth(bold_part, 'DejaVuBold', size) c.setFont('DejaVu', size) max_width = W - margin - x - indent - 10 first_line_remaining = max_width - bw words = rest.split() line1 = '' leftover_words = [] for i, w in enumerate(words): test = line1 + ' ' + w if line1 else w if pdfmetrics.stringWidth(test, 'DejaVu', size) < first_line_remaining: line1 = test else: leftover_words = words[i:] break c.drawString(x + indent + bw, y, line1) yy = y if leftover_words: lines = [] current = '' for w in leftover_words: test = current + ' ' + w if current else w if pdfmetrics.stringWidth(test, 'DejaVu', size) < max_width: current = test else: lines.append(current) current = w if current: lines.append(current) for line in lines: yy -= (size + 1.5) c.drawString(x + indent, yy, line) return yy - (size + 1.5) - 1 # ============ PAGE LAYOUT ============ x = margin y = H - margin # Title y = draw_title(c, y, 'De Post Kitchen Reference', 16) c.setFont('DejaVuOblique', 8) c.drawCentredString(W/2, y, 'Byzantine fasting tradition \u00b7 Genetic protocol \u00b7 Kitchen structure') y -= 18 # === MEAL STRUCTURE === (two columns, NO line separator before) col_w = (W - 2 * margin) / 2 left_x = margin right_x = margin + col_w + 10 # Left column yL = y # FIX 1: Remove Japanese characters, just use romanized term yL = draw_heading(c, left_x, yL, 'MEAL STRUCTURE: Ichiju-Sansai', 9) c.setFont('DejaVuOblique', 7) c.drawString(left_x, yL, '"One soup, three dishes" \u2014 Japanese framework, Romanian soul') yL -= 12 yL = draw_bold_bullet(c, left_x, yL, 'Ciorb\u0103 ', '(the soup) \u2014 always first, the anchor of every meal', 7.5) yL = draw_bold_bullet(c, left_x, yL, 'M\u0103m\u0103lig\u0103 ', '(the starch) \u2014 cornmeal base; test on CGM vs rice', 7.5) yL = draw_bold_bullet(c, left_x, yL, 'Tocan\u0103 ', '(the stew) \u2014 main dish, heavy on onion + paprika', 7.5) yL = draw_bold_bullet(c, left_x, yL, 'Mur\u0103turi ', '(the pickles) \u2014 fermented vegetables, probiotic', 7.5) yL -= 4 c.setFont('DejaVuOblique', 7) c.drawString(left_x, yL, 'De post = no meat, no dairy, no eggs. Fish on certain days.') yL -= 14 # Right column - Genetic Protocol yR = y yR = draw_heading(c, right_x, yR, 'GENETIC DIET PROTOCOL', 9) c.setFont('DejaVuOblique', 7) c.drawString(right_x, yR, 'Derived from 23andMe v4 genome, March 2026') yR -= 12 yR = draw_bold_bullet(c, right_x, yR, 'Low sat fat \u2014 ', 'olive oil + fish oil primary. No butter/coconut.', 7) yR = draw_bold_bullet(c, right_x, yR, 'No liquid dairy \u2014 ', 'LCT GG. Hard aged cheese borderline.', 7) yR = draw_bold_bullet(c, right_x, yR, 'Big meal midday \u2014 ', 'MTNR1B het. Evening carbs spike insulin.', 7) yR = draw_bold_bullet(c, right_x, yR, 'Coffee AM only \u2014 ', 'CYP1A2 slow. Max 2 cups. Half-life 5-8hrs.', 7) yR = draw_bold_bullet(c, right_x, yR, 'No charred meat \u2014 ', 'NAT2 slow + 8q24 GG. Avoid HCAs.', 7) yR = draw_bold_bullet(c, right_x, yR, 'No/minimal alcohol \u2014 ', 'AAT Pi*Z carrier + fast ADH1B.', 7) yR = draw_bold_bullet(c, right_x, yR, 'Fatty fish 3-4x/wk \u2014 ', 'salmon, sardines, mackerel (FADS1).', 7) yR = draw_bold_bullet(c, right_x, yR, 'Cruciferous veg \u2014 ', 'upregulates weak GSTP1 detox.', 7) yR = draw_bold_bullet(c, right_x, yR, 'Fermented foods \u2014 ', 'support FUT2 het microbiome.', 7) yR = draw_bold_bullet(c, right_x, yR, 'OMAD/2MAD \u2014 ', 'fasting is primary metabolic lever (PPARG).', 7) y = min(yL, yR) - 6 # === THE FOUR DISHES === (NO line separator, just spacing) y = draw_heading(c, x, y, 'THE FOUR DISHES', 10) y -= 2 # --- Ciorba --- y = draw_heading(c, x, y, 'CIORB\u0102 (Sour Soup)', 8.5) yy = y c.setFont('DejaVu', 7) col1_x = x c.setFont('DejaVuBold', 7) c.drawString(col1_x, yy, 'Base:') c.setFont('DejaVu', 7) c.drawString(col1_x + 28, yy, 'onion, carrot, parsnip, celery, potato') yy -= 10 c.setFont('DejaVuBold', 7) c.drawString(col1_x, yy, 'Sour:') c.setFont('DejaVu', 7) c.drawString(col1_x + 28, yy, 'bor\u0219 (fermented wheat bran) OR lemon OR sauerkraut brine') yy -= 10 c.setFont('DejaVuBold', 7) c.drawString(col1_x, yy, 'Add:') c.setFont('DejaVu', 7) c.drawString(col1_x + 28, yy, 'green beans, bell pepper, zucchini, tomatoes') yy -= 10 c.setFont('DejaVuBold', 7) c.drawString(col1_x, yy, 'Herbs:') c.setFont('DejaVu', 7) c.drawString(col1_x + 33, yy, 'leu\u0219tean (lovage) is canonical. Backup: dill + parsley.') yy -= 10 c.setFont('DejaVuBold', 7) c.drawString(col1_x, yy, 'Method:') c.setFont('DejaVu', 7) c.drawString(col1_x + 40, yy, 'Saut\u00e9 aromatics \u2192 add root veg + water \u2192 simmer 20m \u2192 add soft veg \u2192 10m \u2192 add sour \u2192 herbs off heat') yy -= 12 y = yy # --- Tocana --- y = draw_heading(c, x, y, 'TOCAN\u0102 (Stew)', 8.5) c.setFont('DejaVu', 7) yy = y c.setFont('DejaVuBold', 7) c.drawString(col1_x, yy, 'Key:') c.setFont('DejaVu', 7) c.drawString(col1_x + 25, yy, '1:1 onion-to-main-ingredient ratio by weight. The onion IS the sauce.') yy -= 10 c.setFont('DejaVuBold', 7) c.drawString(col1_x, yy, 'Method:') c.setFont('DejaVu', 7) c.drawString(col1_x + 40, yy, 'Dice tons of onion \u2192 cook low 15-20m until melted \u2192 kill heat \u2192 stir in boia (paprika)') yy -= 10 c.drawString(col1_x + 40, yy, '\u2192 add main ingredient \u2192 brown \u2192 add tomatoes + barely cover with water \u2192 simmer low & slow') yy -= 10 c.setFont('DejaVuBold', 7) c.drawString(col1_x, yy, 'Times:') c.setFont('DejaVu', 7) c.drawString(col1_x + 33, yy, 'Meat: 1.5-2 hrs | Mushrooms: 45 min | Beans: 30 min. Sauce should be thick, not soupy.') yy -= 10 c.setFont('DejaVuBold', 7) c.drawString(col1_x, yy, 'De post:') c.setFont('DejaVu', 7) c.drawString(col1_x + 40, yy, 'ciuperci (mushroom) or fasole (bean). Serve over m\u0103m\u0103lig\u0103.') yy -= 12 y = yy # --- Mamaliga --- y = draw_heading(c, x, y, 'M\u0102M\u0102LIG\u0102 (Cornmeal Porridge)', 8.5) c.setFont('DejaVu', 7) yy = y c.setFont('DejaVuBold', 7) c.drawString(col1_x, yy, 'Ratio:') c.setFont('DejaVu', 7) c.drawString(col1_x + 33, yy, '1 cup coarse cornmeal : 3 cups water : 1 tsp salt. Whisk cornmeal into boiling salted water.') yy -= 10 c.setFont('DejaVuBold', 7) c.drawString(col1_x, yy, 'Method:') c.setFont('DejaVu', 7) c.drawString(col1_x + 40, yy, 'Stir constantly over medium heat 20-30 min until pulls from sides. Invert onto board.') yy -= 10 c.setFont('DejaVuBold', 7) c.drawString(col1_x, yy, 'Note:') c.setFont('DejaVu', 7) c.drawString(col1_x + 30, yy, 'Test on CGM \u2014 if corn spikes like rice, sub sweet potato or beans as starch base.') yy -= 12 y = yy # --- Muraturi --- y = draw_heading(c, x, y, 'MUR\u0102TURI (Pickles/Ferments)', 8.5) c.setFont('DejaVu', 7) yy = y c.drawString(col1_x, yy, 'Traditional lacto-fermented vegetables: cabbage (varz\u0103 murat\u0103), cucumbers (castrave\u021bi mura\u021bi),') yy -= 10 c.drawString(col1_x, yy, 'peppers, green tomatoes, cauliflower. Brine = water + salt (no vinegar). Ferment 1-3 weeks.') yy -= 10 c.drawString(col1_x, yy, 'Serve alongside every meal. The brine (zeam\u0103 de mur\u0103turi) can also sour ciorb\u0103 in a pinch.') yy -= 14 y = yy # --- Bors maintenance --- (spacing instead of line) y -= 2 y = draw_heading(c, x, y, 'BOR\u0218 MAINTENANCE', 9) c.setFont('DejaVu', 7) yy = y c.drawString(col1_x, yy, 'Main supply: strain liquid \u2192 fridge. Keeps 2-3 weeks. Use for ciorb\u0103.') yy -= 10 # FIX 5: Add bors ratio details c.drawString(col1_x, yy, 'Starter/mother: small jar with liquid + sediment \u2192 fridge.') yy -= 10 c.setFont('DejaVuBold', 7) c.drawString(col1_x, yy, 'New batch from starter:') c.setFont('DejaVu', 7) c.drawString(col1_x + 110, yy, '1 cup wheat bran + 1 tbsp cornmeal + 4 cups warm water + starter liquid. Ferment 2-3 days.') yy -= 10 c.drawString(col1_x, yy, 'Feed starter every few weeks with 2 tbsp bran + 1 cup warm water to keep culture alive.') yy -= 10 c.drawString(col1_x, yy, 'If it turns vinegary (acetic), use for marinades and start a fresh batch from starter.') yy -= 14 y = yy # FIX 3: Add berberine to daily supplements y -= 2 y = draw_heading(c, x, y, 'DAILY SUPPLEMENTS', 9) c.setFont('DejaVu', 7) c.drawString(x, y, 'Berberine (Thorne) | Fish oil 2-4g EPA+DHA | Vitamin D | Collagen + Vit C (pre-training)') y -= 10 c.drawString(x, y, 'Retinol (or liver weekly) | B-complex (pending bloodwork)') y -= 14 # FIX 4: REMOVED "Key Screenings" section # Footer c.setFont('DejaVuOblique', 6) c.drawCentredString(W/2, margin - 10, 'Generated March 2026 from genome analysis + Romanian de post tradition + ichiju-sansai structure') c.save() print(f"PDF saved to {outpath}")